C#通过正则表达式判断字符是否为数字

int str="121212,1212"

const string pattern = "^[0-9]*$";
Regex rx = new Regex(pattern);
return rx.IsMatch(str); //bool类型

猜你喜欢

转载自www.cnblogs.com/shanshuiYiCheng/p/10551064.html