String

Common
JVM
JS
Native
1.0
fun String(chars: CharArray): String

Converts the characters in the specified array to a string.

Common
JVM
JS
Native
1.0
fun String(
    chars: CharArray,
    offset: Int,
    length: Int
): String

Converts the characters from a portion of the specified array to a string.

Exceptions

IndexOutOfBoundsException - if either offset or length are less than zero or offset + length is out of chars array bounds.

JVM
1.0
fun String(
    bytes: ByteArray,
    offset: Int,
    length: Int,
    charset: Charset
): String

Converts the data from a portion of the specified array of bytes to characters using the specified character set and returns the conversion result as a string.

Parameters

bytes - the source array for the conversion.

offset - the offset in the array of the data to be converted.

length - the number of bytes to be converted.

charset - the character set to use.

JVM
1.0
fun String(bytes: ByteArray, charset: Charset): String

Converts the data from the specified array of bytes to characters using the specified character set and returns the conversion result as a string.

JVM
1.0
fun String(
    bytes: ByteArray,
    offset: Int,
    length: Int
): String

Converts the data from a portion of the specified array of bytes to characters using the UTF-8 character set and returns the conversion result as a string.

Parameters

bytes - the source array for the conversion.

offset - the offset in the array of the data to be converted.

length - the number of bytes to be converted.

JVM
1.0
fun String(bytes: ByteArray): String

Converts the data from the specified array of bytes to characters using the UTF-8 character set and returns the conversion result as a string.

JVM
1.0
fun String(
    codePoints: IntArray,
    offset: Int,
    length: Int
): String

Converts the code points from a portion of the specified Unicode code point array to a string.

JVM
1.0
fun String(stringBuffer: StringBuffer): String

Converts the contents of the specified StringBuffer to a string.

JVM
1.0
fun String(stringBuilder: StringBuilder): String

Converts the contents of the specified StringBuilder to a string.