📜  java如何检查字符串是数字 - Java代码示例

📅  最后修改于: 2022-03-11 14:52:06.946000             🧑  作者: Mango

代码示例1
public static boolean isNumeric(String strNum) {
    if (strNum == null) {
        return false;
    }
    try {
        double d = Double.parseDouble(strNum);
    } catch (NumberFormatException nfe) {
        return false;
    }
    return true;
}