用正则判断字符串是否为数字

 System.Text.RegularExpressions.Regex

rex =  new System.Text.RegularExpressions.Regex(@"^\d+$");


 if (rex.IsMatch(intChar))

{

return Convert.ToInt32(intChar); 

原文地址:https://www.cnblogs.com/Andynamo/p/1689901.html