I have a string that consists of continuous spaces like
a(double space)b c d (Double space) e f g h (double space) i
split like
a
b c d
e f g h
i
at present i am trying like this
Regex r = new Regex(" +");
string[] splitString = r.Split(strt);
Python String split() MethodThe split() method splits a string into a list. You can specify the separator, default separator is any whitespace. Note: When maxsplit is specified, the list will contain the specified number of elements plus one.
The split() method splits a string into an array of substrings. The split() method returns the new array. The split() method does not change the original string. If (" ") is used as separator, the string is split between words.
You can use String.Split
:
var items = theString.Split(new[] {" "}, StringSplitOptions.None);
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