StringBuffer:setLength(length)

Decrease the length of the StringBuffer to length bytes. If the length specified is greater than the current StringBuffer length, the new length is ignored.

Example

sb = StringBuffer.new()
sb:append('foobar')
sb:setLength(3)