//定义一个变量
String str="0"

//这个校验为整数
str.matches("\\d+")

//这个校验为浮点数
str.matches("\\d+\\.\\d*");

  

相关文章: