clear

Clears the content of this string builder making it empty and returns this instance.

@IgnorableReturnValueexpect fun StringBuilder.clear(): StringBuilder(source)
fun main() {
    val sb = StringBuilder("Hello, Kotlin!")
    println("Before clear: '${sb.toString()}'") // prints: Hello, Kotlin!
    sb.clear()
    println("After clear: '${sb.toString()}'")   // prints: (empty string)
}

Source