码迷,mamicode.com
首页 > 其他好文 > 详细

判断字符串是否是数字

时间:2018-09-12 20:21:06      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:div   ring   system   string   print   bool   arp   har   stat   

public class IsString {
    public static boolean isNum(String str){
        return str.matches("^[-+]?(([0-9]+)([.]([0-9]+))?|([.]([0-9]+))?)$");
    }
    @Test
    public void test(){
        String str = "12344.33";
        System.out.println(IsString.isNum(str));
    }
}

  


判断字符串是否是数字

标签:div   ring   system   string   print   bool   arp   har   stat   

原文地址:https://www.cnblogs.com/fulucky/p/9636407.html

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