/** * 手机号用****号隐藏中间数字 * * @param phone * @return */public static String settingphone(String phone) { String phone_s = phone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"); return phone_s;} /** * 邮箱用****号隐藏前面的字母 * * @return */public static String settingemail(String email) { String emails = email.replaceAll("(\\w?)(\\w+)(\\w)(@\\w+\\.[a-z]+(\\.[a-z]+)?)", "$1****$3$4"); return emails;}
时间: 2024-10-05 20:35:52