Package | Description |
---|---|
org.dromara.hutool.core.text.escape |
提供各种转义和反转义实现
|
org.dromara.hutool.core.text.replacer |
文本替换类抽象及实现
|
Modifier and Type | Class and Description |
---|---|
class |
Html4Escape
HTML4的ESCAPE
参考:Commons Lang3
|
class |
Html4Unescape
HTML4的UNESCAPE
|
class |
NumericEntityUnescaper
形如'的反转义器
|
class |
XmlEscape
XML特殊字符转义
见:https://stackoverflow.com/questions/1091945/what-characters-do-i-need-to-escape-in-xml-documents & (ampersand) 替换为 & < (less than) 替换为 < > (greater than) 替换为 > " (double quote) 替换为 " |
class |
XmlUnescape
XML的UNESCAPE
|
Modifier and Type | Class and Description |
---|---|
class |
HighMultiReplacer
高效替换器,通过查找指定关键字,替换对应的值
基于AC自动机算法实现,需要被替换的原字符串越大,替换的键值对越多,效率提升越明显
注意: 如果需要被替换的关键字出现交叉,最先匹配中的关键字会被替换
1、"abc","ab" 会优先替换"ab"
2、"abed","be" 会优先替换"abed"
3、"abc", "bc" 会优先替换"abc"
|
class |
HighMultiReplacerV2
高效替换器,通过查找指定关键字,替换对应的值
基于AC自动机算法实现,需要被替换的原字符串越大,替换的键值对越多,效率提升越明显
注意: 如果需要被替换的关键字出现交叉,最先匹配中的关键字会被替换
1、"abc","ab" 会优先替换"ab"
2、"abed","be" 会优先替换"abed"
3、"abc", "bc" 会优先替换"abc"
|
class |
LookupReplacer
查找替换器,通过查找指定关键字,替换对应的值
|
class |
RangeReplacerByChar
区间字符串替换,指定区间,将区间中的所有字符去除,替换为指定的字符,字符重复次数为区间长度,即替换后字符串长度不变
此方法使用 CharSequence.codePoints() 完成拆分替换 |
class |
RangeReplacerByStr
区间字符串替换,指定区间,将区间中的所有字符去除,替换为指定的字符串,字符串只重复一次
此方法使用 CharSequence.codePoints() 完成拆分替换 |
class |
ReplacerChain
字符串替换链,用于组合多个字符串替换逻辑
|
class |
SearchReplacer
查找替换器
查找给定的字符串,并全部替换为新的字符串,其它字符不变 |
Modifier and Type | Method and Description |
---|---|
Iterator<StrReplacer> |
ReplacerChain.iterator() |
Modifier and Type | Method and Description |
---|---|
ReplacerChain |
ReplacerChain.addChain(StrReplacer element) |
Constructor and Description |
---|
ReplacerChain(StrReplacer... strReplacers)
构造
|
Copyright © 2025. All rights reserved.