【发布时间】:2020-01-09 22:02:07
【问题描述】:
这个想法是像使用信用卡一样屏蔽字符串。可以用这一行代码来完成。它有效。但是我找不到在这种情况下使用的正则表达式的任何直接解释。
public class Solution {
public static void main(String[] args) {
String t1 = "518798673672531762319871";
System.out.println(t1.replaceAll(".(?=.{4})", "*"));
}
}
输出为:********************9871
【问题讨论】:
-
你有解释here
标签: java regex string replaceall