| | |
| | | |
| | | // 判断字符串是否为手机号码 |
| | | public static boolean isMobileNumber(String aTelNumber) { |
| | | Pattern p = Pattern.compile("(^1((((3[5-9])|(47)|(5[0-2])|(5[7-9])|(82)|(8[7-8]))\\d{8})|((34[0-8])\\d{7}))$)|(^1((3[0-2])|(5[5-6])|(8[0-6]))\\d{8}$)|(^1((33[0-9])|(349)|(53[0-9])|(80[0-9])|(89[0-9]))\\d{7}$)"); |
| | | String regex = "^((13[0-9])|(14[0-9])|(17[0-9])|(15[^4,\\D])|(18[0-9])|(19[0-9])|(16[0-9]))\\d{8}$"; |
| | | Pattern p = Pattern.compile(regex); |
| | | Matcher m = p.matcher(aTelNumber); |
| | | return m.matches(); |
| | | |
| | | if (aTelNumber == null || aTelNumber.equals("") || aTelNumber.length() != 11) { |
| | | |
| | | return false; |
| | | |
| | | } else { |
| | | return m.find(); |
| | | } |
| | | } |
| | | |
| | | // 格式化手机号码 |