New v0.1.0
Creates an empty builder.
Package: Text
Signature
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
import Text::StringBuilder;
func Main() -> int {
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();
return 0;
}
See also
StringBuilder— the builder typeWithCapacity— reserve the room up frontFree— release the block when the builder is finished with