[REBOL] Re: Splitting string based on substring separator
From: fuka:fuxoft:cz at: 22-Dec-2002 1:37
Thanks, this sounds promising. Unfortunately, my string is binary,
containing all possible bytes...
[SunandaDH--aol--com] wrote:
> Frantisek :
>
>>and I want to split it to substrings based on the separator string (in
>> this case, "sep").
>
> I'm sure you may get more elegant answers, but when I was faced with the same
> problem, I solved it by replacing the "sep" string with a single character
> that did not (should not!) appear in the string, I used a hex ff -- so:
>
> unlikely-char: to-string to-char 255
> original-string: "HELLOsepP E O P L EsepHOWsepAREsepYOU"
> replace/all original-string "sep" unlikely-char
> print mold parse/all original-string unlikely-char
>
> ["HELLO" "P E O P L E" "HOW" "ARE" "YOU"]
>
> Sunanda.
--
Frantisek Fuka
(yes, that IS my real name)
(and it's pronounced "Fran-tjee-shek Foo-kah")
----------------------------------------------------
My E-mail: [fuka--fuxoft--cz]
My Homepage: http://www.fuxoft.cz
My ICQ: 2745855