判断字符串是否为数字

    xiaoxiao2021-03-25  118

    /** * 判断字符串是否为数字 * * 正则表达式判断 * * @param str 字符串 * @return boolean */ public static boolean isNumeric(String str){ Pattern pattern = Pattern.compile("[0-9]*"); Matcher isNum = pattern.matcher(str); if( !isNum.matches() ){ return false; } return true; }

    转载请注明原文地址: https://ju.6miu.com/read-9453.html

    最新回复(0)