看代码
/**
* 判断字符串是否全部为数字
*
* @param str
* @return
*/
public static boolean isNumber(String str) {
if (str.matches("-?\\d+")) return true;
try {
Double.parseDouble(str);
return true;
} catch (NumberFormatException e) {
logger.error("类型转化异常:" + e);
return false;
}
}