Wednesday, April 20, 2011
string.Split
There is no question that, compared to C++, C# makes working with strings a lot easier. However, some things still don't make sense. I have used the split method on the string class countless times. I could count on one hand the number of times I had more than one argument to split by. Why is there no overload that takes a single string or char, and doesn't force me to write code that creates a single element array inline so I can satisfy the method signature requirements ?
Subscribe to:
Post Comments (Atom)
To encourage noobs to write their first extension method.
ReplyDeletePS I hope your wife's doing better.
Thanks - she is doing a lot better. Good answer :P
ReplyDeleteGlad to hear it.
ReplyDeleteWhat's wrong with
ReplyDelete"Split me into words!".Split(' ', StringSplitOptions.RemoveEmptyEntries);
???