Hi Sterling,

one little detail: your approach works well enough with this particular
example because space is one of the desired delimiters.

Conceivably Tim may want a more universal solution that enables him to
determine whether or not he wants to include spaces in his parse rule. In
that case IMHO it would be more appropriate to use parse's all refinement
and - for the sake of this particular example - include space explicitly as
a delimiter in the rule:

With space:
>> parse/all "one#two%three four" "%# "
== ["one" "two" "three" "four"]

Without space
>> parse/all "one#two%three four" "%#"
== ["one" "two" "three four"]

Note that the second version returns "three four" as one string because
space is not included in the rule.

At 09:06 PM 4/10/00 -0700, you wrote:
>
>You really ought to just try these things. ;)
>You'll be surprised at what you find.
>
>>> parse "one#two%three four" "#%"
>== ["one" "two" "three" "four"]
>>> 
>
>Sterling
>
>> I would like to have a function to do
>> the following
>> 1)take two strings as arguments
>>   a)arg one is source
>>   b) arg two is delimiters
>> 2)return a series
>> 
>> it would work like this:
>> 
>> my-series: string-to-series "one#two%three four" "#% "
>> my-series is returned as ["one" "two" "three" "four"]
>> 
>> BTW: I have a c function that does this. With
>> subsequent function calls, it is about 40 lines of
>> code. I'm pretty lost when it comes to parse, but
>> I bet the rebol function would be shorter.
>> thanks
>> tim
>
>
>

;- Elan >> [: - )]

Reply via email to