what does `ensureCapacity` and `setLength` do in `...
# kotlin-native
s
what does
ensureCapacity
and
setLength
do in
StringBuilder
j
ensureCapacity updates the array with the new size if the capacity you've specificed is larger than the current array size. setLength will just specify the length you want for when you run methods such as
trimToSize
and the likes, but also holds much of the indexing logic because of setLength being directly tied to _length which much of the StringBuilder logic is based on
s
ok