New
Creates an empty builder.
Module: Text
Signature
rux
func New() -> StringBuilder;Returns
An empty StringBuilder. It holds no block until the first append, so this allocates nothing: Length and Capacity are both 0, and Data is null.
The first Append takes a block of 16 bytes and doubles from there. Reach for WithCapacity instead when the final size is known up front.
Example
rux
import Text::StringBuilder;
var builder = StringBuilder::New();
builder.Capacity(); // 0 -- nothing is allocated yet
builder.Append("Rux");
builder.Capacity(); // 16 -- the first append takes a block
builder.Free();See also
StringBuilder— the builder typeWithCapacity— reserve the room up frontFree— release the block when the builder is finished with