clear

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

Since Kotlin

1.3

Samples

import java.util.Locale
import kotlin.test.*

fun main() { 
   //sampleStart 
   val builder = StringBuilder()
builder.append("content").append(1)
println(builder) // content1

builder.clear()
println(builder) // 
   //sampleEnd
}
actual inline fun StringBuilder.clear(): StringBuilder(source)

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

Since Kotlin

1.3

Samples

import java.util.Locale
import kotlin.test.*

fun main() { 
   //sampleStart 
   val builder = StringBuilder()
builder.append("content").append(1)
println(builder) // content1

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

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

Since Kotlin

1.3

Samples

import java.util.Locale
import kotlin.test.*

fun main() { 
   //sampleStart 
   val builder = StringBuilder()
builder.append("content").append(1)
println(builder) // content1

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

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

Since Kotlin

1.8

Samples

import java.util.Locale
import kotlin.test.*

fun main() { 
   //sampleStart 
   val builder = StringBuilder()
builder.append("content").append(1)
println(builder) // content1

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

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

Since Kotlin

1.8

Samples

import java.util.Locale
import kotlin.test.*

fun main() { 
   //sampleStart 
   val builder = StringBuilder()
builder.append("content").append(1)
println(builder) // content1

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