Basically, I want to be able to use string.Split(char[])
without actually defining a char array as a separate variable. I know in other languages you could do like string.split([' ', '\n']);
or something like that. How would I do this in C#?
Here's a really nice way to do it:
string[] s = myString.Split("abcdef".ToCharArray());
The above is equivalent to:
string[] s = myString.Split('a', 'b', 'c', 'd', 'e', 'f');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With