Re: split() function

new topic     » topic index » view thread      » older message » newer message

No Solution wrote:

> That's the most more what i had in mind, but i was too lazy to code
> something like that, and at the time i wrote the function i only needed to
> use 1 character so..

I still haven't seen a solution to this which correctly handles the following
boundary conditions:

(for these examples, the pipe character is the delimiter, and we expect to
return a sequence of sequences )

1) null string in front of the first delimiter.

"|two|three|four|five"    should return { {}, "two", "three", "four", "five" }

2) adjacent delimiters with null string between them.

"one|||five"    should return { "one", {}, {}, {}, "five" }

3) sequence ending in a delimiter.

"one|two|three|four|"    should return { "one", "two", "three", "four", {} }

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu