This commit is contained in:
Looly 2022-09-23 22:06:59 +08:00
parent d672ee9fee
commit 62c80a2184
3 changed files with 10 additions and 2 deletions

View File

@ -37,6 +37,10 @@ import java.util.function.Supplier;
*/
public class CharSequenceUtil extends StrChecker {
/**
* 未找到的的位置表示-1表示
* @see Finder#INDEX_NOT_FOUND
*/
public static final int INDEX_NOT_FOUND = Finder.INDEX_NOT_FOUND;
/**

View File

@ -8,6 +8,9 @@ package cn.hutool.core.text.finder;
*/
public interface Finder {
/**
* 未找到的的位置表示-1表示
*/
int INDEX_NOT_FOUND = -1;
/**
@ -28,9 +31,10 @@ public interface Finder {
/**
* 复位查找器用于重用对象
*
* @return this
*/
default Finder reset(){
default Finder reset() {
return this;
}
}

View File

@ -31,7 +31,7 @@ public class CharSequenceUtilTest {
final String result = CharSequenceUtil.replace(replace, 5, 12, "***");
Assert.assertEquals("SSM15***01BeryAllen", result);
String emoji = StrUtil.replace("\uD83D\uDE00aabb\uD83D\uDE00ccdd", 2, 6, "***");
final String emoji = StrUtil.replace("\uD83D\uDE00aabb\uD83D\uDE00ccdd", 2, 6, "***");
Assert.assertEquals("\uD83D\uDE00a***ccdd", emoji);
}