ensureCapacity

Common
JS
Native
1.3
fun ensureCapacity(minimumCapacity: Int)
For Common, Native

Ensures that the capacity of this string builder is at least equal to the specified minimumCapacity.

If the current capacity is less than the minimumCapacity, a new backing storage is allocated with greater capacity. Otherwise, this method takes no action and simply returns.

For JS

Ensures that the capacity of this string builder is at least equal to the specified minimumCapacity.

If the current capacity is less than the minimumCapacity, a new backing storage is allocated with greater capacity. Otherwise, this method takes no action and simply returns.

In Kotlin/JS implementation of StringBuilder the size of the backing storage is not extended to comply the given minimumCapacity, thus calling this method has no effect on the further performance of operations.