java判断是否是数字

public static boolean checkNum(String number) {
  String rex = "^[1-9]\\d*(\\.\\d+)?$";
  Pattern p = Pattern.compile(rex);
  Matcher m = p.matcher(number);
  return m.find();
}

猜你喜欢

转载自www.cnblogs.com/csk-1/p/9334983.html