[REBOL] Re: Splitting string based on substring separator
From: sunandadh:aol at: 21-Dec-2002 19:19
> 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"]