/// <summary>
/// 带小数点数字匹配
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static bool IsNumber(string input)
{
string pattern = "^-?\d+$|^(-?\d+)(\.\d+)?$";
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(pattern);
return regex.IsMatch(input);
}
/// <summary>
/// 数字匹配
/// </summary>
/// <param name="strNumber"></param>
/// <returns></returns>
public static bool IsWholeNumber(string strNumber)
{
System.Text.RegularExpressions.Regex g = new System.Text.RegularExpressions.Regex(@"^[0-9]d*$");
return g.IsMatch(strNumber);
}