标签:
公司开发新功能需要验证手机号码,遂自己写了个出来,暂只支持中国大陆手机号验证。如有不妥之处,还望大家不吝赐教,感激不尽!
/** * 验证是否是正确合法的手机号码 * * @param telephone * 需要验证的打手机号码 * @return 合法返回true,不合法返回false * */ public static boolean isCellPhoneNo(String telephone) { if (Common.empty(telephone)) { return false; } if (telephone.length() != 11) { return false; } Pattern pattern = Pattern.compile("^1[3,5]\\d{9}||18[6,8,9]\\d{8}$"); Matcher matcher = pattern.matcher(telephone); if (matcher.matches()) { return true; } return false; }
原文地址:http://www.iyuze.cn/article/607.html
标签:
原文地址:http://blog.csdn.net/justyuze/article/details/44340115