.NET 2.0 - Text Splitting Text
Suppose you have output like this:
Word1 Word2 Word3 Word4
Where the number of spaces between words is arbitrary. I want to split it into an array of words.
I used the following code:
string[] tokens =
new List<String>(input.Split(' '))
.FindAll
(
delegate(string token)
{
return token != String.Empty;
}
).ToArray();
Not really efficient, but does the job well.
How do you do it?
+1
source to share