Are there any valid reasons why there isn't an overload of the String.Split
which accepts a delimiter string and a text to be split?
string[] Split(string delimiter)
which could then be used like
string input = "This - is - an - example";
string[] splitted = input.Split(" - ");
// results in:
// { "This", "is", "an", "example" }
I really know, that I can create an extention method easily, but there must be valid reason why this has not been added.
Please note, that I am not looking for a solution of how to split a string using a string delimiter, I am rather looking for an explanation, why such an overload could cause problems. This is because I don't think it would really cause problems and I find it really hard for a beginners to understand why we have to pass an actual string[]
instead of a simple string
as a delimiter.