trimToSize

Common
JS
Native
1.3
fun trimToSize()
For Common, Native

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.

For JS

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.