Using system.text.regularExpressions; // Don't this
1, separated by string:
String str = "aaajsbbbjsccc";
String [] Sarray = regex.split (Str, "JS", regexoptions.ignorecase;
FOREACH (String I in Sarray)
Console.write (I.toTString () "/ n");
Output results:
AAA
BBB
CCC
2, separated by multiple characters: string str = "aaajbbbscccjddddseee"; string [] sarray = str.split (new char [2] {'J', 's'}); Foreach (String i in sarray) Console. Write (i.tostring () "/ n"); output results: AAABBBCCCDDDeee3, separated by single characters: string str = "aaajbbbjccc"; string [] Sarray = Str.Split ('J'); Foreach (String i In Sarray) Console.Write (I.TOString () "/ n"); Output Result: AAABBBCCC