|
-
May 17th, 2004, 04:15 PM
#1
Split() in C#
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
-
May 17th, 2004, 04:25 PM
#2
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 )
-
May 17th, 2004, 04:31 PM
#3
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..
-
May 17th, 2004, 04:36 PM
#4
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);
}
string Signature = Censored; 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|