ensureCapacity

expect fun ensureCapacity(minimumCapacity: Int)(source)

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.

Since Kotlin

1.4
actual fun ensureCapacity(minimumCapacity: Int)(source)

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.

Since Kotlin

1.4
actual fun ensureCapacity(minimumCapacity: Int)(source)

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.

Since Kotlin

1.3