toSet

Returns a Set of all characters.

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

Source