| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * @description: 身份证手机号脱敏处理 |
| | | * @author: Null |
| | |
| | | return phoneNumber; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 身份证号码脱敏处理 |
| | | * |
| | |
| | | return idNumber; |
| | | } |
| | | |
| | | |
| | | public static String replaceName(String str) { |
| | | String reg = ".{1}"; |
| | | StringBuffer sb = new StringBuffer(); |
| | | Pattern p = Pattern.compile(reg); |
| | | Matcher m = p.matcher(str); |
| | | int i = 0; |
| | | while (m.find()) { |
| | | i++; |
| | | if (i == 1) |
| | | continue; |
| | | m.appendReplacement(sb, "*"); |
| | | } |
| | | m.appendTail(sb); |
| | | return sb.toString(); |
| | | } |
| | | } |