日期:2014-05-18 浏览次数:20866 次
string str = "AA+BC-CD*FI+AC/AK"; string[] arr = str.Split(new char[] { '+', '-', '*', '/' }); for (int i = 0; i < 100; i++) { str = string.Join(i.ToString(), arr)+i.ToString(); }
------解决方案--------------------
放在循环里
tempStr = @"AA+BC-CD*FI+AC/AK"; string pattern = @"(?=[+\-*/]|$)"; string result = Regex.Replace(tempStr, pattern, "1");//AA1+BC1-CD1*FI1+AC1/AK1