[REBOL] Re: How to compose a string with a specific separator
From: ale870:gm:ail at: 12-Jul-2007 22:36
Hello, I created this small function: composeBlock.
>> composeBlock: func [argDivider [string!] argData [block!] /local newBlock
][newBlock: [] foreach i argData [ app
end newBlock reduce [argDivider i] ] return copy next newBlock ]
>>
>> composeBlock "," [1 2 3 4 5]
== [1 "," 2 "," 3 "," 4 "," 5]
>>
On 7/12/07, Tom <Tom.Conlin-gmail.com> wrote:
>
> Carlos Lorenz wrote:
> > Hi ppl
> >
> >
> >
> > a: [1 2 3]
> >> parse a [any [blk: skip (unless empty? next blk [insert next blk ","])
> >> skip
> >> ] ]
> >>
> >> == [ 1 "," 2 "," 3" ]
> >>
> >
> > Whenever I read things like that I feel like I miss a lot about the pow
> er of
> > REBOL parse dialect.
> >
> > I=B4ll leave a suggestion to the gurus on parsing: please write some "p
> arsing
> > for dummies" tutorial. It would be of great help!
> >
>
> slightly shorter version of Max's
>
> parse a [any[skip here: (all[not tail? here insert here ","])skip]]
> --
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
>
--
--Alessandro