Java 判断String是否是int数值

/**
     * 判断是否是int数值
     * @param str
     * @return
     */
    public static boolean isInteger(String str) {
        Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
        return pattern.matcher(str).matches();
    }

 

posted @ 2020-09-30 15:12  千夜大魔王  阅读(2045)  评论(1编辑  收藏  举报