How can I convert CharArray / Array to a String?

you can simply using Array#joinToString:

val result: String = chars.joinToString("");

OR convert chars to CharArray:

val result: String = String(chars.toCharArray());

OR declaring a primitive CharArray by using charArrayOf:

val chars = charArrayOf('A', 'B', 'C');
val result: String = String(chars);

Leave a Comment

tech