W3cubDocs

/Kotlin

clear

Platform and version requirements: JS (1.3)
fun clear(): StringBuilder

Clears the content of this string builder making it empty.

import kotlin.test.*

fun main(args: Array<String>) {
//sampleStart
val builder = StringBuilder()
builder.append("content").append(1)
println(builder) // content1

builder.clear()
println(builder) //
//sampleEnd
}

© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/-string-builder/clear.html