public abstract class StrReplacer extends Object implements UnaryOperator<CharSequence>, Serializable
Constructor and Description |
---|
StrReplacer() |
Modifier and Type | Method and Description |
---|---|
CharSequence |
apply(CharSequence str)
执行替换,按照
replace(CharSequence, int, StringBuilder) 逻辑替换对应部分,其它部分保持原样 |
protected abstract int |
replace(CharSequence str,
int pos,
StringBuilder out)
抽象的字符串替换方法,通过传入原字符串和当前位置,执行替换逻辑,返回处理或替换的字符串长度部分。
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
identity
protected abstract int replace(CharSequence str, int pos, StringBuilder out)
str
- 被处理的字符串pos
- 当前位置out
- 输出public CharSequence apply(CharSequence str)
replace(CharSequence, int, StringBuilder)
逻辑替换对应部分,其它部分保持原样apply
in interface Function<CharSequence,CharSequence>
str
- 被处理的字符串Copyright © 2025. All rights reserved.