Tim,

These suggestions are very helpful.  Thanks for posting them.  And thanks to
Tom!!

Stan

-----Original Message-----
...

> printf22: func[str [string!] subs [block!] /local delim blk x][
>     delim: "%s"
> 
> ;;; this is not quite as good anymore
> ;;;  with subs being circular final length is not exactly known.
> ;;; (without more work)
>     blk: make string! add length? str length? to string! subs
> 
>     parse/all str [
>         some[
>             delim
>             (   insert tail blk first subs
>                 if tail? subs: next subs[subs: head subs]; 'wrap' subs
>             )
>             |
>             copy x [to delim] ;;; specify everything to the next delim
>             (insert tail blk x)
>          ] ; end some
> 
>          copy x [to end]   (insert tail blk x)
>          ;;; otherwise you loose potential text after the last %s
>          ;;; if %s was last you append nothing which doesnt hurt
>    ]; end parse
>    blk
> ];end func
> 

...

> 
> printf-inplace-change: func [
>                       str[string!] subs[block!]
>                       /locals delims mark
> ][
>         delims: "%s"
>         len-dem: length? delims
>         parse/all str[
>                 some [
>               to delims
>               mark:   ; parse at beginning of replacement text
>               (       change/part :mark first subs len-dem
>                       mark: skip :mark length? to string! first subs
>                       ;unless yer subs have embedded delims ...
>                       if tail? subs: next subs[subs: head subs]
>                       ; circular replacemnt block
>               )
>               :mark   ; parse at end of replaced text
>            ]
>        ]
>        str
> ]
> 

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to