Examples for Split Function

Split Function can be used to split strings on spaces

string s = "Splitting a string";
string[] words = s.Split(' ');
foreach (string word in words)
{
Console.WriteLine(word);
}

Output :
Splitting
a
string

Leave a Reply

Your email address will not be published. Required fields are marked *