[REBOL] Re: Newbie Q: Search and delete from a Block
From: chris:ross-gill at: 8-Oct-2002 12:38
Hi,
> join word-split "hellotherethisisanexample" "this"
> == "hellothereisanexample"
>> rejoin word-split "hellotherethisisanexample" "this"
== "hellothereisanexample"
I'm sure there's a more elegant way to do it than my effort below, or one
that splits the string at all instances of the word...
- Chris
--
REBOL []
word-split: func [
string [string!] word [string!] /local first second
][
if not second: find string word [return reduce [string]]
first: copy/part string second
second: copy skip second length? word
return reduce [first second]
]