-
* 隐藏部分手机号码
-
* @param phone
-
* @return
-
*/
-
public static String hidePhoneNum(String phone){
-
String result = "";
-
if (phone != null && !"".equals(phone)) {
-
if (isMobileNum(phone)) {
-
result = phone.substring(0, 3) + "****" + phone.substring(7);
-
}
-
}
-
return result;
-
}
-
/**
-
* 检查是否是电话号码
-
*
-
* @return
-
*/
-
public static boolean isMobileNum(String mobiles) {
-
Pattern p = Pattern
-
.compile("^((13[0-9])|(14[0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$");
-
Matcher m = p.matcher(mobiles);
-
return m.matches();
-
}