Hello, :wave: Is there a way to identify extended...
# android
a
Hello, 👋 Is there a way to identify extended grapheme clusters? 👩‍👩‍👧‍👧 👍🏽 <- My use case is detecting first user perceived character in a String
r
can you elaborate some more
1
a
String[0] in the cases I posted return the first section of the unicode character that the emote is composed of :
Copy code
val text = "👩‍👩‍👧‍👧 user perceived characters 👍🏽"
print(text[0])

?
👩‍👩‍👧‍👧 =
\u200D\uD83D\uDC69\u200D\uD83D\uDC67\u200D\uD83D\uDC66
Android Studio does not support Zero Width Joiner characters so it look like this in the IDE:
r
unicode takes up more than one position in a string
1
a
Yeah, I'm asking because I did not see any clear way to achieve this in Kotlin / Java / Android (the question posted is web specific.)
I happy to create a Stack Overflow question myself.
This was
Added in API level 24
So would still need something backwards compatible
g
Nothing is simple when dealing with emoji and I’m probably missing the point but couldn’t you loop through the codepoints and find the zero width joiners?
a
You are right to some extent, there are some cases where zero width joiners are not present.