どうも、ちょげ(@chogetarou)です。
文字列(String)を1文字ずつに分割したMutableListに変換する方法を紹介します。
方法

文字列(String)を1文字ずつに分割したMutableListに変換するには、toMutableList()を使います。
具体的には、str.toMutableList()
のように、文字列からtoMutableList()を呼び出します。
val result : MutableList<Char> = text.toMutableList()
上記のtoMutableList()は、呼び出した文字列を1文字ずつに分割したMutableList<Char>を返します。
使用例
fun main() {
val text = "abcdefg"
val result : MutableList<Char> = text.toMutableList()
println(result)
}
出力:
[a, b, c, d, e, f, g]
コメント