C# split

C# split divides a string, and return an array of substrings.

string s="Endmemo.com CSharp String Tutorial";
string[] arr=s.Split(' '); //divided by space
foreach(string elem in arr)
{
   ...
}
 //divided by letter t and T, case insensitive
string[] arr=s.Split('t',s, StringSplitOptions.IgnoreCase);

C# split can use a substring as separator.
string s="'Endmemo.com','CSharp','23.432.32.6'";
//divided by substring ','
string[] arr=s.Split(new string[] {"','"}, StringSplitOptions.None); 
foreach(string elem in arr)
{
   ...
}

endmemo.com © 2017  Terms of Use | Home