//正则表达式判断字符串可以是任意的数字
public boolean isNumeric(String str){
Pattern pattern = Pattern.compile("-?[0-9]+\\.?[0-9]+");
Matcher isNum = pattern.matcher(str);
if( !isNum.matches() ){ return false; } return true; }
转载于:https://www.cnblogs.com/gwq369/p/5333097.html