From 1431e27a7ba9b25dd9a570834ef5b4e24ef7d60d Mon Sep 17 00:00:00 2001 From: Abduqodiri Qurbonzoda Date: Thu, 14 Nov 2019 07:28:00 +0300 Subject: [PATCH] Move StringBuilder to its own file --- libraries/stdlib/common/src/kotlin/TextH.kt | 25 ------------------- .../stdlib/src/kotlin/text/StringBuilder.kt | 24 ++++++++++++++++++ 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/libraries/stdlib/common/src/kotlin/TextH.kt b/libraries/stdlib/common/src/kotlin/TextH.kt index d5948fbebd3..40cb8d596fb 100644 --- a/libraries/stdlib/common/src/kotlin/TextH.kt +++ b/libraries/stdlib/common/src/kotlin/TextH.kt @@ -5,22 +5,6 @@ package kotlin.text -expect class StringBuilder : Appendable, CharSequence { - constructor() - constructor(capacity: Int) - constructor(content: CharSequence) - - override val length: Int - override operator fun get(index: Int): Char - override fun subSequence(startIndex: Int, endIndex: Int): CharSequence - - fun reverse(): StringBuilder - override fun append(c: Char): StringBuilder - override fun append(csq: CharSequence?): StringBuilder - override fun append(csq: CharSequence?, start: Int, end: Int): StringBuilder - fun append(obj: Any?): StringBuilder -} - expect class Regex { constructor(pattern: String) constructor(pattern: String, option: RegexOption) @@ -225,15 +209,6 @@ public expect fun String.decapitalize(): String public expect fun CharSequence.repeat(n: Int): String -/** - * Clears the content of this string builder making it empty. - * - * @sample samples.text.Strings.clearStringBuilder - */ -@SinceKotlin("1.3") -public expect fun StringBuilder.clear(): StringBuilder - - /** * Returns a new string with all occurrences of [oldChar] replaced with [newChar]. */ diff --git a/libraries/stdlib/src/kotlin/text/StringBuilder.kt b/libraries/stdlib/src/kotlin/text/StringBuilder.kt index c35e5bf63b4..b60fd020004 100644 --- a/libraries/stdlib/src/kotlin/text/StringBuilder.kt +++ b/libraries/stdlib/src/kotlin/text/StringBuilder.kt @@ -8,6 +8,30 @@ package kotlin.text +expect class StringBuilder : Appendable, CharSequence { + constructor() + constructor(capacity: Int) + constructor(content: CharSequence) + + override val length: Int + override operator fun get(index: Int): Char + override fun subSequence(startIndex: Int, endIndex: Int): CharSequence + + fun reverse(): StringBuilder + override fun append(c: Char): StringBuilder + override fun append(csq: CharSequence?): StringBuilder + override fun append(csq: CharSequence?, start: Int, end: Int): StringBuilder + fun append(obj: Any?): StringBuilder +} + +/** + * Clears the content of this string builder making it empty. + * + * @sample samples.text.Strings.clearStringBuilder + */ +@SinceKotlin("1.3") +public expect fun StringBuilder.clear(): StringBuilder + /** * Builds new string by populating newly created [StringBuilder] using provided [builderAction] * and then converting it to [String].