Introduce StringBuilder.clear() extension

#KT-18910 Fixed
This commit is contained in:
Ilya Gorbunov
2018-06-14 03:47:16 +03:00
parent c667340261
commit bbee18b84d
6 changed files with 58 additions and 0 deletions
+22
View File
@@ -53,5 +53,27 @@ public actual class StringBuilder(content: String = "") : Appendable, CharSequen
return this
}
/**
* Clears the content of this string builder making it empty.
*
* @sample samples.text.Strings.clearStringBuilder
*/
@SinceKotlin("1.3")
public fun clear(): StringBuilder {
string = ""
return this
}
override fun toString(): String = string
}
/**
* Clears the content of this string builder making it empty.
*
* @sample samples.text.Strings.clearStringBuilder
*/
@SinceKotlin("1.3")
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
public actual fun StringBuilder.clear(): StringBuilder = this.clear()