1、在你的代码中引入hutool的jar包

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

3、startInclude 开始位置(包含)
endExclude 结束位置(不包含)
replacedChar 被替换的字符

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

5、运行程序查看结果

时间:2026-02-13 06:10:28
1、在你的代码中引入hutool的jar包

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

3、startInclude 开始位置(包含)
endExclude 结束位置(不包含)
replacedChar 被替换的字符

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

5、运行程序查看结果
