判断字符串是否为数字

public static boolean isValidNumber(String str) {
    Pattern pattern = Pattern.compile("^[-\+]?[.\d]*$");
    return pattern.matcher(str).matches();
}
原文地址:https://www.cnblogs.com/paper-man/p/13284664.html