1、在项目中引入hutool的jar包

2、首先定义一个String类型的字符串

3、startInclude 开始位置(包含)endExclude 结束位置(不包含)

4、String s = StrUtil.hide(str1,startInclude,endExclude);//替换指定字符串的指定区间内字符为"*"

5、运行程序后查看被隐藏后为结果

1、在项目中引入hutool的jar包

2、首先定义一个String类型的字符串

3、startInclude 开始位置(包含)endExclude 结束位置(不包含)

4、String s = StrUtil.hide(str1,startInclude,endExclude);//替换指定字符串的指定区间内字符为"*"

5、运行程序后查看被隐藏后为结果
