验证手机号码 (包含166和199)

   /**
     * 验证手机号码
     *
     * @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;
    }

 

posted @ 2018-06-22 10:02  岁月淡忘了谁  阅读(910)  评论(0编辑  收藏  举报