
MS: String.Split is missing an IMPORTANT overload (IMO)
Definately can't inherit from string. There are times, such as with comma
delimited lists when two commas in a row should generate a null entry.
I agree that it would take longer to figure out how to do it regex that it
would to write a compress function that would prepare the string for split.
Something like...
Compress(s as string, seperator as char) as string
which would compress all multiples of seperator to a single seperator char.
Then
stringArray = Compress(theString, " ").split(nothing)
Quote:
> Hi,
> In case some MS-VB.NET guys are lurking around, might I suggest that there
> is another Split overload that could be a BIG help (or it's there, I can't
> find it). An overload of Split should only return substrings that are
> separated by 1 or more of the delimiting characters. In fact that is the
> way that the documentation reads ("Returns an array of substrings that are
> delimited by one or more of the characters in 'separator' " [paraphased]).
> BUT, as in the VB6 version, Split returns 1-more array elements with a
value
> of null if there is more than one delimiting character. This makes for a
> bunch of additional logic in order to separate the "good" data from the
> nulls.
> One of the uses for the Split method is to parse text. I want to parse on
> 1-more white spaces and NOT get a bunch of null array entries mingled in
> with the good stuff.
> For VB 6 I ended up writing my own function. I had hoped that VB.NET
would
> take care of the problem. And, of course, overloading Split is out of the
> question since String is immutable.
> Have I missed something?
> Larry Woods