Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
fun extractGraphemeClusters(input: String): List<String> {
val characters = mutableListOf<String>()
val iterator = BreakIterator.getCharacterInstance()
var start = iterator.first()
var iterated = false
while (!iterated) {
val next =
if (next == BreakIterator.DONE) {
iterated = true
val extracted = input.substring(start, next)
start = next
characters += extracted
return characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment