Java加入手机号的校验

    /**
     * 校验手机号
     * @param telephone
     * @return
     */
    public static boolean isCellPhoneNo(String telephone) {
        if (telephone == null || telephone.trim().equals("")) {
            return false;
        }
        if (telephone.length() != 11) {
            return false;
        }
        Pattern pattern = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$");
        Matcher matcher = pattern.matcher(telephone);

        return matcher.matches();

    }

你可能感兴趣的:(Java加入手机号的校验)