toSortedSet

Returns a new SortedSet of all characters.

fun CharSequence.toSortedSet(): SortedSet<Char>(source)
fun main() {
    val text = "kotlin"
    val sortedSet: SortedSet<Char> = text.toSortedSet()
    println(sortedSet)  // Output: [i, k, l, n, o, t]
}

Source