日期:2014-05-18 浏览次数:21518 次
string source = "12234"; Regex reg = new Regex(@"([\d])(?=\1)"); source = reg.Replace(source, ""); //source = 1234
------解决方案--------------------
linq
string tempStr = "12234"; string temp_list=string.Join("",tempStr.ToCharArray().Distinct());//1234
------解决方案--------------------
Try
string source = "122234"; Regex reg = new Regex(@"(\d)(?=[^\1]*\1)"); source = reg.Replace(source, ""); //source = 1234