判断字符串中是否有数字

判断字符串中是否有数字

 

public static boolean HasDigit(String content) {
    boolean flag = false;
    Pattern p = Pattern.compile(".*\\d+.*");
    Matcher m = p.matcher(content);
    if (m.matches()) {
        flag = true;
    }
    return flag;
}

 

 

 

###########################

posted @ 2022-05-11 15:31  西北逍遥  阅读(119)  评论(0编辑  收藏  举报