Hello Rebols:
    I'm a parse-a-phobic, and use it infrequently.
The following function uses 'parse dialect, and appears
to work, but I'd appreciate a critique from anyone on
it. Given my unfamiliarity with parse, you just might
be preventing me from chasing a bug sometime:

Thanks!

Code follows:
; Replace "%s" with members of a block. In the spirit
; of C, LISP, python format strings
printf: function[str[string!] subs[block!]] 
        [delims non-delims blk ndx ][
        delims: charset "%s"
        non-delims: complement delims
        blk: copy []
        ndx: 1
        parse/all str[
                some [
                        copy txt some non-delims (
                                append blk txt 
                                if ndx <= (length? subs)[
                                        append blk subs/:ndx
                                        ]
                                ndx: ndx + 1
                                ) | 
                                delims
                        ] ; end some
                ]
        rejoin blk
        ];end func 

;I appreciate the input, also, there used to be a function
;posted at rebol.org that might have done something similar.
;Couldn't find it last I looked.

Regards
-- 
Tim Johnson <[EMAIL PROTECTED]>
      http://www.alaska-internet-solutions.com
-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to