public class ReplacerChain extends StrReplacer implements Chain<StrReplacer,ReplacerChain>
Constructor and Description |
---|
ReplacerChain(StrReplacer... strReplacers)
构造
|
Modifier and Type | Method and Description |
---|---|
ReplacerChain |
addChain(StrReplacer element)
加入责任链
|
Iterator<StrReplacer> |
iterator() |
protected int |
replace(CharSequence str,
int pos,
StrBuilder out)
抽象的字符串替换方法,通过传入原字符串和当前位置,执行替换逻辑,返回处理或替换的字符串长度部分。
|
replace
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public ReplacerChain(StrReplacer... strReplacers)
strReplacers
- 字符串替换器public Iterator<StrReplacer> iterator()
iterator
in interface Iterable<StrReplacer>
public ReplacerChain addChain(StrReplacer element)
Chain
addChain
in interface Chain<StrReplacer,ReplacerChain>
element
- 责任链新的环节元素protected int replace(CharSequence str, int pos, StrBuilder out)
StrReplacer
replace
in class StrReplacer
str
- 被处理的字符串pos
- 当前位置out
- 输出Copyright © 2024. All rights reserved.