java判断是否是数字

来源:互联网 发布:尼尔森数据怎么查 编辑:程序博客网 时间:2024/05/16 10:10
public static boolean isNumeric(String str){ 
   Pattern pattern = Pattern.compile("[0-9]*"); 
   return pattern.matcher(str).matches();    


返回true:代表是数字;

返回false:代表不是数字

0 0