Introduce Common String.toCharArray(destination) #KT-60657
Merge-request: KT-MR-11340 Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
aa0eca6d6d
commit
84c6333b23
@@ -169,6 +169,27 @@ public expect fun String.toCharArray(): CharArray
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public expect fun String.toCharArray(startIndex: Int = 0, endIndex: Int = this.length): CharArray
|
||||
|
||||
/**
|
||||
* Copies characters from this string into the [destination] character array and returns that array.
|
||||
*
|
||||
* @param destination the array to copy to.
|
||||
* @param destinationOffset the position in the array to copy to.
|
||||
* @param startIndex the start offset (inclusive) of the substring to copy.
|
||||
* @param endIndex the end offset (exclusive) of the substring to copy.
|
||||
*
|
||||
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this string builder indices or when `startIndex > endIndex`.
|
||||
* @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],
|
||||
* or when that index is out of the [destination] array indices range.
|
||||
*/
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.9")
|
||||
public expect fun String.toCharArray(
|
||||
destination: CharArray,
|
||||
destinationOffset: Int = 0,
|
||||
startIndex: Int = 0,
|
||||
endIndex: Int = length
|
||||
): CharArray
|
||||
|
||||
/**
|
||||
* Decodes a string from the bytes in UTF-8 encoding in this array.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user