public class RangeReplacerByChar extends StrReplacer
CharSequence.codePoints()
完成拆分替换Constructor and Description |
---|
RangeReplacerByChar(int beginInclude,
int endExclude,
char replacedChar,
boolean isCodePoint)
构造
|
Modifier and Type | Method and Description |
---|---|
String |
apply(CharSequence str)
执行替换,按照
StrReplacer.replace(CharSequence, int, StringBuilder) 逻辑替换对应部分,其它部分保持原样 |
protected int |
replace(CharSequence str,
int pos,
StringBuilder out)
抽象的字符串替换方法,通过传入原字符串和当前位置,执行替换逻辑,返回处理或替换的字符串长度部分。
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
identity
public RangeReplacerByChar(int beginInclude, int endExclude, char replacedChar, boolean isCodePoint)
beginInclude
- 开始位置(包含)endExclude
- 结束位置(不包含)replacedChar
- 被替换的字符串isCodePoint
- 是否code point模式,此模式下emoji等会被作为单独的字符public String apply(CharSequence str)
StrReplacer
StrReplacer.replace(CharSequence, int, StringBuilder)
逻辑替换对应部分,其它部分保持原样apply
in interface Function<CharSequence,CharSequence>
apply
in class StrReplacer
str
- 被处理的字符串protected int replace(CharSequence str, int pos, StringBuilder out)
StrReplacer
replace
in class StrReplacer
str
- 被处理的字符串pos
- 当前位置out
- 输出Copyright © 2025. All rights reserved.