decodeToString

Decodes a string from the bytes in UTF-8 encoding in this array.

Malformed byte sequences are replaced by the replacement char \uFFFD.

Since Kotlin

1.4

expect fun ByteArray.decodeToString(startIndex: Int = 0, endIndex: Int = this.size, throwOnInvalidSequence: Boolean = false): String(source)

Decodes a string from the bytes in UTF-8 encoding in this array or its subrange.

Since Kotlin

1.4

Parameters

startIndex

the beginning (inclusive) of the subrange to decode, 0 by default.

endIndex

the end (exclusive) of the subrange to decode, size of this array by default.

throwOnInvalidSequence

specifies whether to throw an exception on malformed byte sequence or replace it by the replacement char \uFFFD.

Throws

if startIndex is less than zero or endIndex is greater than the size of this array.

if the byte array contains malformed UTF-8 byte sequence and throwOnInvalidSequence is true.

Decodes a string from the bytes in UTF-8 encoding in this array.

Malformed byte sequences are replaced by the replacement char \uFFFD.

Since Kotlin

1.4

actual fun ByteArray.decodeToString(startIndex: Int = 0, endIndex: Int = this.size, throwOnInvalidSequence: Boolean = false): String(source)

Decodes a string from the bytes in UTF-8 encoding in this array or its subrange.

Since Kotlin

1.4

Parameters

startIndex

the beginning (inclusive) of the subrange to decode, 0 by default.

endIndex

the end (exclusive) of the subrange to decode, size of this array by default.

throwOnInvalidSequence

specifies whether to throw an exception on malformed byte sequence or replace it by the replacement char \uFFFD.

Throws

if startIndex is less than zero or endIndex is greater than the size of this array.

if the byte array contains malformed UTF-8 byte sequence and throwOnInvalidSequence is true.

Decodes a string from the bytes in UTF-8 encoding in this array.

Malformed byte sequences are replaced by the replacement char \uFFFD.

Since Kotlin

1.4

actual fun ByteArray.decodeToString(startIndex: Int = 0, endIndex: Int = this.size, throwOnInvalidSequence: Boolean = false): String(source)

Decodes a string from the bytes in UTF-8 encoding in this array or its subrange.

Since Kotlin

1.4

Parameters

startIndex

the beginning (inclusive) of the subrange to decode, 0 by default.

endIndex

the end (exclusive) of the subrange to decode, size of this array by default.

throwOnInvalidSequence

specifies whether to throw an exception on malformed byte sequence or replace it by the replacement char \uFFFD.

Throws

if startIndex is less than zero or endIndex is greater than the size of this array.

if the byte array contains malformed UTF-8 byte sequence and throwOnInvalidSequence is true.

Decodes a string from the bytes in UTF-8 encoding in this array.

Malformed byte sequences are replaced by the replacement char \uFFFD.

Since Kotlin

1.3

actual fun ByteArray.decodeToString(startIndex: Int = 0, endIndex: Int = this.size, throwOnInvalidSequence: Boolean = false): String(source)

Decodes a string from the bytes in UTF-8 encoding in this array or its subrange.

Since Kotlin

1.3

Parameters

startIndex

the beginning (inclusive) of the subrange to decode, 0 by default.

endIndex

the end (exclusive) of the subrange to decode, size of this array by default.

throwOnInvalidSequence

specifies whether to throw an exception on malformed byte sequence or replace it by the replacement char \uFFFD.

Throws

if startIndex is less than zero or endIndex is greater than the size of this array.

if the byte array contains malformed UTF-8 byte sequence and throwOnInvalidSequence is true.

Decodes a string from the bytes in UTF-8 encoding in this array.

Malformed byte sequences are replaced by the replacement char \uFFFD.

Since Kotlin

1.8

actual fun ByteArray.decodeToString(startIndex: Int = 0, endIndex: Int = this.size, throwOnInvalidSequence: Boolean = false): String(source)

Decodes a string from the bytes in UTF-8 encoding in this array or its subrange.

Since Kotlin

1.8

Parameters

startIndex

the beginning (inclusive) of the subrange to decode, 0 by default.

endIndex

the end (exclusive) of the subrange to decode, size of this array by default.

throwOnInvalidSequence

specifies whether to throw an exception on malformed byte sequence or replace it by the replacement char \uFFFD.

Throws

if startIndex is less than zero or endIndex is greater than the size of this array.

if the byte array contains malformed UTF-8 byte sequence and throwOnInvalidSequence is true.

Decodes a string from the bytes in UTF-8 encoding in this array.

Malformed byte sequences are replaced by the replacement char \uFFFD.

Since Kotlin

1.8

actual fun ByteArray.decodeToString(startIndex: Int = 0, endIndex: Int = this.size, throwOnInvalidSequence: Boolean = false): String(source)

Decodes a string from the bytes in UTF-8 encoding in this array or its subrange.

Since Kotlin

1.8

Parameters

startIndex

the beginning (inclusive) of the subrange to decode, 0 by default.

endIndex

the end (exclusive) of the subrange to decode, size of this array by default.

throwOnInvalidSequence

specifies whether to throw an exception on malformed byte sequence or replace it by the replacement char \uFFFD.

Throws

if startIndex is less than zero or endIndex is greater than the size of this array.

if the byte array contains malformed UTF-8 byte sequence and throwOnInvalidSequence is true.