to String
Converts the contents of this byte array to a string using the specified charset.
Samples
import samples.*
import java.util.Locale
import kotlin.test.*
fun main() {
//sampleStart
val charset = Charsets.UTF_8
val byteArray = "Hello".toByteArray(charset)
assertPrints(byteArray.contentToString(), "[72, 101, 108, 108, 111]")
assertPrints(byteArray.toString(charset), "Hello")
//sampleEnd
}