How to find the characters that a string consists of in Kotlin

1 Answer

0 votes
fun main() {
    val string = "Kotlin is a general-purpose programming language"

    val uniqueChars = string.toSet()

    println(uniqueChars)
}

 
 
/*
run:
   
[K, o, t, l, i, n,  , s, a, g, e, r, -, p, u, m]
   
*/

 



answered Nov 25, 2024 by avibootz
...