KT-23356 Cross-platform function to convert CharArray slice to String
Signed-off-by: Valeriy Zhirnov <neonailol@gmail.com>
This commit is contained in:
@@ -7,6 +7,24 @@ package kotlin.text
|
||||
|
||||
import kotlin.js.RegExp
|
||||
|
||||
/**
|
||||
* Converts the characters in the specified array to a string.
|
||||
*/
|
||||
@SinceKotlin("1.2")
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun String(chars: CharArray): String {
|
||||
return js("String.fromCharCode").apply(null, chars)
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the characters from a portion of the specified array to a string.
|
||||
*/
|
||||
@SinceKotlin("1.2")
|
||||
public actual fun String(chars: CharArray, offset: Int, length: Int): String {
|
||||
return String(chars.copyOfRange(offset, offset + length))
|
||||
}
|
||||
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun String.toUpperCase(): String = asDynamic().toUpperCase()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user