In Best Practices for Using Strings in the .NET Framework we are encouraged to supply proper StringComparison
whenever we are comparing strings. I agree with the point but I see that unlike other methods, String.Split()
actually does not have overloads with comparison parameter.
Is there equivalent of String.Split()
taking string comparisons somewhere in the framework or am I expected to write my own?
The closest thing is Regex.Split
. It can ignore case and culture.
Example: Regex.Split("FirstStopSecondSTOPThird", "stop", RegexOptions.IgnoreCase)
Will result in:
First
Second
Thrid