使用的正则,比subString()按位数截取省事很多!
public static void main(String[] args) {
String phone = "18501234234";
String hidenPhone = phone.replaceAll("(\\d{3})\\d{4}(\\d{4})","$1****$2");
System.out.println(hidenPhone);
}
欢迎大家加入QQ群:258298887 共同学习 共同进步