码迷,mamicode.com
首页 > 编程语言 > 详细

java判断是否是数字

时间:2018-07-19 13:47:59      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:match   .com   pil   mat   com   pattern   return   boolean   find   

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();
}

java判断是否是数字

标签:match   .com   pil   mat   com   pattern   return   boolean   find   

原文地址:https://www.cnblogs.com/csk-1/p/9334983.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!