/**
* 手机号验证
* @return 验证通过返回true
*/
public static boolean checkMobile(String str) {
Pattern p = null;
Matcher m = null;
boolean b = false;
p = Pattern.compile("1[3,4,5,7,8,9][0-9]{9}KaTeX parse error: Expected 'EOF', got '}' at position 89: … return b; }̲ /** *…"); // 验证带区号的
m = p1.matcher(str);
b = m.matches();
return b;
}
1 ↩︎
本文介绍了一种用于验证中国手机号码有效性的方法,通过正则表达式匹配检查手机号是否符合13、14、15、17、18、19开头的11位数字格式。该方法适用于需要进行手机号验证的各类应用。
6831

被折叠的 条评论
为什么被折叠?



