C#中,Split()里的参数是char,所以只能用单引号,如str.Split(',');
用双引号是报错的,如str.Split(",");
Split有以下使用方式
public string[] Split(params char[] separator);
public string[] Split(char[] separator, int count);
public string[] Split(char[] separator, StringSplitOptions options);
public string[] Split(string[] separator, StringSplitOptions options);
public string[] Split(char[] separator, int count, StringSplitOptions options);
public string[] Split(string[] separator, int count, StringSplitOptions options);
如果想以字符串分隔,可以
str.Split(new string[] { "AB" }, StringSplitOptions.None); (小熊吉米 提供)