/** * 验证手机号码 * * @param * @return boolean */ public static boolean isPhoneNumber(String phoneNo) { if (TextUtils.isEmpty(phoneNo)) { return false; } if (phoneNo.length() == 11) { for (int i = 0; i < 11; i++) { if (!PhoneNumberUtils.isISODigit(phoneNo.charAt(i))) { return false; } } // Pattern p = Pattern.compile("^((13[^4,\\D])" + "|(134[^9,\\D])" + // "|(14[5,7])" + // "|(15[^4,\\D])" + // "|(17[3,6-8])" + // "|(18[0-9]))\\d{8}$"); Pattern p = Pattern.compile("^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57]|19[0-9]|16[0-9])[0-9]{8}$"); Matcher m = p.matcher(phoneNo); return m.matches(); } return false; }
验证手机号码 (包含166和199)
猜你喜欢
转载自www.cnblogs.com/henuyuxiang/p/9212066.html
今日推荐
周排行