C# 判断字符串是否为数字

public static bool IsNumber(string s)
{
if (string.IsNullOrWhiteSpace(s)) return false;
const string pattern = "^[0-9]*$";
Regex rx = new Regex(pattern);
bool RET = rx.IsMatch(s);
return rx.IsMatch(s);
}

原文地址:https://www.cnblogs.com/mamaxiaoling/p/14452892.html