codePointCount
Returns the number of Unicode code points in the specified text range of this String.
inline fun String.codePointCount(beginIndex: Int, endIndex: Int): Int(source)
fun main() {
val text = "Hello 👋🌍!"
val totalCodePoints = text.codePointCount(0, text.length)
println("Total code points: $totalCodePoints") // prints 9
val emojiOnly = text.codePointCount(6, text.length)
println("Code points from index 6: $emojiOnly") // prints 3
}