Reputation: 65
Lets say i have a string:
"Joe Doe is not here"
I want to split this string only where it is multiple white spaces but keep the Joe Doe as one substring.
So that the result would be:
string[] result={"Joe Doe","is","not","Here"}
Upvotes: 3
Views: 987
Reputation: 13864
Use a Regex.Split with @"\s{2,}" as the pattern - which will split wherever there are 2 or more whitespace characters.
Upvotes: 5