Hi,
Is there any equavalent function to VB split() in C# .NET.
In VB 6.0 we can use Split(String, string), splitting the string with multiple characters as string.
Do we have any similar function in C#.
Thanks
Ramesh
Printable View
Hi,
Is there any equavalent function to VB split() in C# .NET.
In VB 6.0 we can use Split(String, string), splitting the string with multiple characters as string.
Do we have any similar function in C#.
Thanks
Ramesh
yes string.Split , eg:
Code:string str = "test 123";
string[] arr = str.Split(' '); // split the string's spaces
//Note: you can also use the Regex class to split strings ( i find it faster )
There is a difference here. In VB 6.0, we can specify string as parameter for Split() method. But string.split() in C# doesnt support it. Is there any way..
you can use Regex , eg:
Code:string str = "somelikestufflikethiswith the word like in it";
foreach(string s in System.Text.RegularExpressions.Regex.Split(str , "like" ,System.Text.RegularExpressions.RegexOptions.IgnoreCase))
{
Console.WriteLine(s);
}