字符串不包含数字

public static boolean judgeContainNumber(String str){
Pattern p = Pattern.compile(".*\\d+.*");
Matcher m = p.matcher(str);
if (m.matches()){
System.out.println("有数字");
return true;
}else {
System.out.println("没有数字");
}
return false;
}

 

posted @ 2022-06-08 16:07  岁月记忆  阅读(91)  评论(0)    收藏  举报