java --手机号码校验

/**
* 手机号码校验
* @param number
* @return
*/
public static boolean checkMobilePhone(String number) {
boolean result = false;
try {
String regex = "[0-9]{11}$";
Pattern check = Pattern.compile(regex);
Matcher matcher = check.matcher(number);
result = matcher.matches();
} catch (Exception e) {
result = false;
}
return result;
}

转载于:https://www.cnblogs.com/toge/p/6114652.html

你可能感兴趣的:(java --手机号码校验)