[REBOL] Re: Tip for splitting very long string ?
From: anton:lexicon at: 16-Apr-2002 1:24
Forgive me if I seem competitive Joel, but I
couldn't resist. I think this would be faster,
featuring the insert tail instead of append
optimization (which I probably learned from you):
>> string: "abcdefghijklmnopqrstuvwxyz"
== "abcdefghijklmnopqrstuvwxyz"
>> block: copy []
== []
>> while [not tail? string][
insert tail block copy/part string 5
string: skip string 5
]
== ""
>> block
== ["abcde" "fghij" "klmno" "pqrst" "uvwxy" "z"]
Note it does modify the index of the string, however
you can set it back afterwards. (And it won't matter
if you make a function of it and pass the string in).
Anton.