编程知识 cdmana.com

The 4 digits in the Java mobile phone number become *, desensitization processing

effect :

Code implementation :
 

String phone = "13100001111";
String phoneResult = phone.replaceAll("(\\d{3})\\d{4}(\\d{4})","$1****$2");
System.out.println(phoneResult);

result :


 

ps: Don't mention the front end to deal with . For data confidentiality , Since we have to deal with it , You must not give non desensitized data to the front-end .

版权声明
本文为[Small target youth]所创,转载请带上原文链接,感谢
https://cdmana.com/2021/08/20210804225239841e.html

Scroll to Top