string.Split for C# is crap. Is there a way to split on CrLf ?
Posted on 2006-06-09
The Split function in C# is the most annying piece of crap I have yet come across while transferring from VB.net.
I want to split on CrLf.
It takes only a char as its argument, and if you pass a single-element char such as Cr, it splits on Cr but leaves a Lf at the end of each element.
If you pass a 2-element char array, containing Cr and Lf, then it splits on EACH character, not on BOTH characters, and one ends up with twice the number of elements as wanted.
Please advise how to do something like this:
result = Foo.Split(Environment.NewLine);