日期:2014-05-18 浏览次数:20757 次
string abc = "123、ff、ddd、eee、fff、kk、ddd、gggggg、kkk、xxxx"; string[] x = abc.Split('、'); String xx = ""; for (int i = 1; i < x.Length + 1; i++) { xx += x[i - 1] + "、"; if (i % 3 == 0) { xx = xx.TrimEnd('、'); xx += "\r\n"; } }
------解决方案--------------------
string abc = "123、ff、ddd、eee、fff、kk、ddd、gggggg、kkk、xxxx"; string[] result = Regex.Split(abc, @"(?<=\G(?:[^、]+、){3})"); foreach (string s in result) Console.WriteLine(s);