trimToSize

expect fun trimToSize()(source)

Attempts to reduce storage used for this string builder.

If the backing storage of this string builder is larger than necessary to hold its current contents, then it may be resized to become more space efficient. Calling this method may, but is not required to, affect the value of the capacity property.

Since Kotlin

1.4
actual fun trimToSize()(source)

Attempts to reduce storage used for this string builder.

If the backing storage of this string builder is larger than necessary to hold its current contents, then it may be resized to become more space efficient. Calling this method may, but is not required to, affect the value of the capacity property.

In Kotlin/JS implementation of StringBuilder the size of the backing storage is always equal to the length of the string builder.

Since Kotlin

1.4
actual fun trimToSize()(source)

Attempts to reduce storage used for this string builder.

If the backing storage of this string builder is larger than necessary to hold its current contents, then it may be resized to become more space efficient. Calling this method may, but is not required to, affect the value of the capacity property.

Since Kotlin

1.3
actual fun trimToSize()(source)

Attempts to reduce storage used for this string builder.

If the backing storage of this string builder is larger than necessary to hold its current contents, then it may be resized to become more space efficient. Calling this method may, but is not required to, affect the value of the capacity property.

Since Kotlin

1.8
actual fun trimToSize()(source)

Attempts to reduce storage used for this string builder.

If the backing storage of this string builder is larger than necessary to hold its current contents, then it may be resized to become more space efficient. Calling this method may, but is not required to, affect the value of the capacity property.

Since Kotlin

1.8