encodeToByteArray
Encodes this string to an array of bytes in UTF-8 encoding.
Any malformed char sequence is replaced by the replacement byte sequence.
Since Kotlin
1.4Encodes this string or its substring to an array of bytes in UTF-8 encoding.
Since Kotlin
1.4Parameters
the beginning (inclusive) of the substring to encode, 0 by default.
the end (exclusive) of the substring to encode, length of this string by default.
specifies whether to throw an exception on malformed char sequence or replace.
Throws
if startIndex is less than zero or endIndex is greater than the length of this string.
if startIndex is greater than endIndex.
if this string contains malformed char sequence and throwOnInvalidSequence is true.
Encodes this string to an array of bytes in UTF-8 encoding.
Any malformed char sequence is replaced by the replacement byte sequence.
Since Kotlin
1.4Encodes this string or its substring to an array of bytes in UTF-8 encoding.
Since Kotlin
1.4Parameters
the beginning (inclusive) of the substring to encode, 0 by default.
the end (exclusive) of the substring to encode, length of this string by default.
specifies whether to throw an exception on malformed char sequence or replace.
Throws
if startIndex is less than zero or endIndex is greater than the length of this string.
if startIndex is greater than endIndex.
if this string contains malformed char sequence and throwOnInvalidSequence is true.
Encodes this string to an array of bytes in UTF-8 encoding.
Any malformed char sequence is replaced by the replacement byte sequence.
Since Kotlin
1.4Encodes this string or its substring to an array of bytes in UTF-8 encoding.
Since Kotlin
1.4Parameters
the beginning (inclusive) of the substring to encode, 0 by default.
the end (exclusive) of the substring to encode, length of this string by default.
specifies whether to throw an exception on malformed char sequence or replace.
Throws
if startIndex is less than zero or endIndex is greater than the length of this string.
if startIndex is greater than endIndex.
if this string contains malformed char sequence and throwOnInvalidSequence is true.
Encodes this string to an array of bytes in UTF-8 encoding.
Any malformed char sequence is replaced by the replacement byte sequence.
Since Kotlin
1.3Encodes this string or its substring to an array of bytes in UTF-8 encoding.
Since Kotlin
1.3Parameters
the beginning (inclusive) of the substring to encode, 0 by default.
the end (exclusive) of the substring to encode, length of this string by default.
specifies whether to throw an exception on malformed char sequence or replace.
Throws
if startIndex is less than zero or endIndex is greater than the length of this string.
if startIndex is greater than endIndex.
if this string contains malformed char sequence and throwOnInvalidSequence is true.
Encodes this string to an array of bytes in UTF-8 encoding.
Any malformed char sequence is replaced by the replacement byte sequence.
Since Kotlin
1.8Encodes this string or its substring to an array of bytes in UTF-8 encoding.
Since Kotlin
1.8Parameters
the beginning (inclusive) of the substring to encode, 0 by default.
the end (exclusive) of the substring to encode, length of this string by default.
specifies whether to throw an exception on malformed char sequence or replace.
Throws
if startIndex is less than zero or endIndex is greater than the length of this string.
if startIndex is greater than endIndex.
if this string contains malformed char sequence and throwOnInvalidSequence is true.
Encodes this string to an array of bytes in UTF-8 encoding.
Any malformed char sequence is replaced by the replacement byte sequence.
Since Kotlin
1.8Encodes this string or its substring to an array of bytes in UTF-8 encoding.
Since Kotlin
1.8Parameters
the beginning (inclusive) of the substring to encode, 0 by default.
the end (exclusive) of the substring to encode, length of this string by default.
specifies whether to throw an exception on malformed char sequence or replace.
Throws
if startIndex is less than zero or endIndex is greater than the length of this string.
if startIndex is greater than endIndex.
if this string contains malformed char sequence and throwOnInvalidSequence is true.