C#里 str="aaa111bbb111ccc111ddd"; 我想把aaa bbb ccc提取出来,该怎么做?
的有关信息介绍如下:下面给你两种办法方法一:Regex reg = new Regex(@"([a-zA-Z]+)\d+([a-zA-Z]+)\d+([a-zA-Z]+)"); string text = "aaa111bbb111ccc111dddd"; if (reg.IsMatch(text)) { GroupCollection regGroup = reg.Match(text).Groups; foreach (Group item in regGroup) { Response.Write(item.Value); Response.Write("
"); } } Response.Write("..................");方法二: string[] t = text.Replace("111", "|").Split('|'); foreach (string item in t) { Response.Write(item); Response.Write("
"); }
版权声明:文章由 去问问 整理收集,来源于互联网或者用户投稿,如有侵权,请联系我们,我们会立即处理。如转载请保留本文链接:https://www.qwenw.com/answer/349148.html