[C#] 多分隔符文本分割
作者:互联网
1 string s = "1,\r\n2,\r\n3,\r\n"; 2 s.Replace(",", "").Replace("\r", "").Split('\n').ToList(); //结果 : [1,2,3,""] 3 s.Split(new string[] { ",", "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries).ToList(); //结果 : [1,2,3]
标签:ToList,n3,string,C#,Replace,Split,分隔符,文本 来源: https://www.cnblogs.com/WikiChen/p/16220313.html