String tel = "18304072984";
// 括号表示组,被替换的部分$n表示第n组的内容
tel = tel.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
System.out.print(tel); // output: 183****2984

相关文章:

  • 2022-01-09
  • 2021-12-15
  • 2021-09-18
  • 2021-12-16
  • 2021-11-27
  • 2021-12-18
  • 2022-01-04
  • 2022-12-23
猜你喜欢
  • 2021-10-13
  • 2021-11-27
  • 2021-12-05
  • 2021-11-27
  • 2022-12-23
  • 2022-02-18
  • 2022-01-13
相关资源
相似解决方案