This commit is contained in:
Looly
2025-04-21 18:22:48 +08:00
parent 49093afcd4
commit 861b961b6f

View File

@@ -24,6 +24,7 @@ public class IssueI96LWHTest {
@Test
public void replaceByCodePointTest() {
final String str = "\uD83D\uDC46最上方点击蓝字";
Assertions.assertArrayEquals(new int[]{128070, 26368, 19978, 26041, 28857, 20987, 34013, 23383}, str.codePoints().toArray());
// 这个方法里\uD83D\uDC46表示一个emoji表情使用codePoint之后一个表情表示一个字符因此按照一个字符对
Assertions.assertEquals("\uD83D\uDC46最上下点击蓝字", StrUtil.replaceByCodePoint(str, 3, 4, ""));