toCharArray

JVM
Native
1.0
fun String.toCharArray(): CharArray

Returns a new character array containing the characters from this string.

JVM
1.0
fun String.toCharArray(
    destination: CharArray,
    destinationOffset: Int = 0,
    startIndex: Int = 0,
    endIndex: Int = length
): CharArray

Copies characters from this string into the destination character array and returns that array.

Parameters

destination - the array to copy to.

destinationOffset - the position in the array to copy to.

startIndex - the start offset (inclusive) of the substring to copy.

endIndex - the end offset (exclusive) of the substring to copy.