110,533
社区成员
发帖
与我相关
我的任务
分享
//验证是否为dec(5,2)小数
public bool IsValidDecimal5_2(string strIn)
{
//return Regex.IsMatch(strIn, @"[0].\d{1,2}|[1]");
return Regex.IsMatch(strIn, @"[0-150].\d{0,2}}");
}
//验证是否为dec(4,2)小数
public bool IsValidDecimal4_2(string strIn)
{
//return Regex.IsMatch(strIn, @"[0].\d{1,2}|[1]");
return Regex.IsMatch(strIn, @"[0-99].\d{0,2}");
}
//验证是否为dec(4,2)小数
public bool IsValidDecimal2_1(string strIn)
{
//return Regex.IsMatch(strIn, @"[0].\d{1,2}|[1]");
return Regex.IsMatch(strIn, @"[0-9].\d{0,1}");
}
//验证是否为int类型整数
public bool IsValidInt(string strIn)
{
//return Regex.IsMatch(strIn, @"[0].\d{1,2}|[1]");
return Regex.IsMatch(strIn, @"\d");
}
//验证是否为dec(5,2)小数
public bool IsValidDecimal5_2(string strIn)
{
return Regex.IsMatch(strIn, @"^[+-]?(?=([0-9]{1,5}$|[0-9.]{3,6}$))(0|[1-9][0-9]{0,4})(\.[0-9]{1,2})?$",RegexOptions.ExplicitCapture);
}
//验证是否为dec(4,2)小数
public bool IsValidDecimal4_2(string strIn)
{
return Regex.IsMatch(strIn, @"^[+-]?(?=([0-9]{1,4}$|[0-9.]{3,5}$))(0|[1-9][0-9]{0,3})(\.[0-9]{1,2})?$", RegexOptions.ExplicitCapture);
}
//验证是否为dec(2,1)小数
public bool IsValidDecimal2_1(string strIn)
{
return Regex.IsMatch(strIn, @"^(?=([0-9]{1,2}$|[0-9.]{3}$))(0|[1-9][0-9]{0,1})(\.[0-9])?$", RegexOptions.ExplicitCapture);
}
//验证是否为int类型整数
public bool IsValidInt(string strIn)
{
return Regex.IsMatch(strIn, @"^[+-]?(0|[1-9][0-9]*)$", RegexOptions.ExplicitCapture);
}