toCollection

Appends all characters to the given destination collection.

@IgnorableReturnValuefun <C : MutableCollection<in Char>> CharSequence.toCollection(destination: C): C(source)
val text = "Hello, Kotlin!"
val chars = mutableListOf<Char>()

text.toCollection(chars)   // appends every character of 'text' to 'chars'

println(chars) // prints: [H, e, l, l, o, ,,  , K, o, t, l, i, n, !]

Source