Fixing for emoji families

This commit is contained in:
Vitor Pamplona 2023-07-06 17:36:11 -04:00
parent 64d96ab1d7
commit 84600c016e
2 changed files with 7 additions and 1 deletions

View File

@ -41,7 +41,8 @@ fun String.firstFullChar(): String {
start = next
} else {
// If join, searches for the next char
if (codePoint == 0x200D) {
if (codePoint == 0xFE0F) {
} else if (codePoint == 0x200D) {
isInJoin = true
} else {
// stops when two chars are not joined together

View File

@ -49,4 +49,9 @@ class CharsetTest {
fun testTeacher() {
Assert.assertEquals("\uD83E\uDDD1\uD83C\uDFFF\u200D\uD83C\uDFEB", "\uD83E\uDDD1\uD83C\uDFFF\u200D\uD83C\uDFEBasdf".firstFullChar())
}
@Test
fun testVariation() {
Assert.assertEquals("\uD83D\uDC68\u200D\u2764\uFE0F\u200D\uD83D\uDC8B\u200D\uD83D\uDC68", "\uD83D\uDC68\u200D\u2764\uFE0F\u200D\uD83D\uDC8B\u200D\uD83D\uDC68ddd".firstFullChar())
}
}