[C#] 字符串内容按符号拼接

1             string str = "1,\r\n2,\r\n3,\r\n";
2             string.Join(",", str.Split(new string[] { ",", "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Select(s => s));  //结果 : 1,2,3

 

posted @ 2022-05-04 08:34  WikiChen  阅读(83)  评论(0编辑  收藏  举报