static bool IsNumeric(string str)
{
System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^\d+[.]?\d*$");
return reg1.IsMatch(str);
}

支持负数
static bool IsNumeric(string str)
{
System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^[-]?\d+[.]?\d*$");
return reg1.IsMatch(str);
}

相关文章:

  • 2021-07-25
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-07
  • 2021-09-01
猜你喜欢
  • 2021-12-06
  • 2021-11-04
  • 2021-09-17
  • 2022-12-23
  • 2022-12-23
  • 2021-09-21
  • 2021-06-13
相关资源
相似解决方案