判断字符串是否全是数字
//判断字符串是否是数字(0.0)
public boolean isNumeric(String str) {
if(str == null || str.equals("")) {
return false;
}
char[] p = str.toCharArray();
for (int i = 0; i < p.length; i++) {
System.out.println("--"+p[i]);
if(!isNum(""+p[i])) {
return false;
}
}
return true;
}
private boolean isNum(String str) {
Pattern pattern = Pattern.compile("[0-9.]*");
Matcher isNum = pattern.matcher(str);
if (!isNum.matches()) {
return false;
}
return true;
}