From 5cde3996004b7809219433605ca5e26a9731c547 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Fri, 1 Jun 2018 18:10:12 +0700 Subject: [PATCH] Support String factory functions --- runtime/src/main/kotlin/kotlin/text/Strings.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/runtime/src/main/kotlin/kotlin/text/Strings.kt b/runtime/src/main/kotlin/kotlin/text/Strings.kt index 89987a79431..15a41f4f040 100644 --- a/runtime/src/main/kotlin/kotlin/text/Strings.kt +++ b/runtime/src/main/kotlin/kotlin/text/Strings.kt @@ -44,3 +44,14 @@ public actual fun CharSequence.repeat(n: Int): String { } } } + +/** + * Converts the characters in the specified array to a string. + */ +// external fun fromCharArray(array: CharArray, start: Int, size: Int) : String +public actual fun String(chars: CharArray): String = fromCharArray(chars, 0, chars.size) + +/** + * Converts the characters from a portion of the specified array to a string. + */ +public actual fun String(chars: CharArray, offset: Int, length: Int): String = fromCharArray(chars, offset, length)