Re: split() function

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

----- Original Message -----
From: "David Garcia" <donovan at ABS.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Wednesday, May 03, 2000 5:57 PM
Subject: Re: split() function


> 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" }

the parse("|two|three|four|five",asc(|)) should do that.

> 2) adjacent delimiters with null string between them.
>
> "one|||five"    should return { "one", {}, {}, {}, "five" }

Why? I can see the following happening:
"one||||five"    should return { "one", {}, {}, {}, "five" }
But that's not what you said.


> 3) sequence ending in a delimiter.
>
> "one|two|three|four|"    should return { "one", "two", "three", "four",
{} }

Again, parse() should do that. It's in the archives by now.

Kat

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

Search



Quick Links

User menu

Not signed in.

Misc Menu