字符串拆分split

public static void output()       

 {            

String s = "aa,bb,cc dd, ee";            

const char comma = ',';            

const char space = ' ';         

char[] schar = new char[]        

{            

comma,           

space        

};            

foreach (String s1 in s.Split(schar))            

{                

Console.WriteLine(s1);           

}        

}

foreach (String s1 in s.Split(schar))也可以直接写foreach (String s1 in s.Split(' ',','))

Split()使用params,参数不限定的

原文地址:https://www.cnblogs.com/gull/p/1855400.html