将手机号中间4位替换为星*号
2019-04-01 本文已影响0人
_灯火阑珊处
String mobile = "13099998888";
mobile = mobile.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
System.out.println(mobile);
输出为
130****8888
String mobile = "13099998888";
mobile = mobile.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
System.out.println(mobile);
输出为
130****8888