public static boolean isNumeric(String str){
Pattern pattern = Pattern.compile("[0-9]*");
return pattern.matcher(str).matches();
Pattern pattern = Pattern.compile("[0-9]*");
return pattern.matcher(str).matches();
}
返回true:代表是数字;
返回false:代表不是数字