java判断字符串是否为数字
String str ="222";
Pattern pattern = Pattern.compile("[0-9]*");
if(pattern.matcher(str).matches()){
System.out.println("是数字");
}else{
System.out.println("非数字");
}
String str ="222";
Pattern pattern = Pattern.compile("[0-9]*");
if(pattern.matcher(str).matches()){
System.out.println("是数字");
}else{
System.out.println("非数字");
}