capacity

Platform and version requirements: JS (1.3)
fun capacity(): Int
Deprecated: Obtaining StringBuilder capacity is not supported in JS and common code.
Platform and version requirements: Native (1.3)
fun capacity(): Int
For Common, Native

Returns the current capacity of this string builder.

The capacity is the maximum length this string builder can have before an allocation occurs.

For JS

Returns the current capacity of this string builder.

The capacity is the maximum length this string builder can have before an allocation occurs.

In Kotlin/JS implementation of StringBuilder the value returned from this method may not indicate the actual size of the backing storage.

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/-string-builder/capacity.html