toByteArray

inline fun String.toByteArray(charset: Charset = Charsets.UTF_8): ByteArray(source)

Encodes the contents of this string using the specified character set and returns the resulting byte array.

Since Kotlin

1.0

Samples