利用正则表达式去除字符串中非数字字符
发布时间:2020-12-14 01:21:19 所属栏目:百科 来源:网络整理
导读:string a ="bkbk9*2.6/7"; 1.去除字符串中非数字 a = Regex.Replace(a,@"[^d]*","");//需用到引用usingSystem.Text.RegularExpressions; 去除后a="9267"; 2.去除字符串中数字 a = Regex.Replace(a,"");//需用到引用usingSystem.Text.RegularExpressions; 去
string a ="bkbk9*2.6/7";1.去除字符串中非数字
|