toReplaceRule

fun String.toReplaceRule(isRegex: Boolean = false, matchIndex: Int? = null, matchRange: IntRange? = null, newString: CharSequence? = null, replacementMatch: OnSpanReplacementMatch? = null): ReplaceRule

创建替换规则

Receiver

查找的字符串或正则文本

Parameters

isRegex

receiver是否为正则

matchIndex

单一匹配位置 (matchRange不为null时优先使用matchRange)

matchRange

匹配范围

newString

替换文本(null 为不替换)

replacementMatch

匹配时回调