验证数字类型代码
public static bool RegexValidate(string validateString)
{
Regex regex = new Regex("^[0-9]+(.[0-9]{0,2})?$");
//验证有两位小数的正实数:^[0-9]+(.[0-9]{2})?$
//验证有1-3位小数的正实数:^[0-9]+(.[0-9]{1,3})?$
return regex.IsMatch(validateString.Trim());
}
{
Regex regex = new Regex("^[0-9]+(.[0-9]{0,2})?$");
//验证有两位小数的正实数:^[0-9]+(.[0-9]{2})?$
//验证有1-3位小数的正实数:^[0-9]+(.[0-9]{1,3})?$
return regex.IsMatch(validateString.Trim());
}