← Standard library

StringBuilder

sealed class StringBuilder
import StringBuilder from Wax;

A mutable UTF-8 text buffer. Lengths, capacities, and editing positions count bytes. Appends copy text; ToString produces an independent immutable string. Insertions and removals clamp their ranges but must respect UTF-8 code-point boundaries. Number formatting is locale-independent; use Format on numeric values when a separate formatted string is wanted.

StringBuilder.wax:20

Inherits from object. Follow these links for inherited members.

Members

constructorconstructor

public constructor ()

Creates an empty builder without reserving a byte buffer.

StringBuilder.wax:39

WithCapacityconstructor

public constructor WithCapacity (int32 capacity)

Creates an empty builder with the requested byte capacity.

StringBuilder.wax:47

lengthgetter

public get length() : int32

The number of UTF-8 bytes currently used.

StringBuilder.wax:55

capacitygetter

public get capacity() : int32

The allocated byte capacity, which can exceed the current length.

StringBuilder.wax:62

EnsureCapacitymethod

public fn EnsureCapacity(int32 capacity) : void

Reserves at least the requested total number of bytes without shrinking or changing the current text.

StringBuilder.wax:96

EnsureAdditionalCapacitymethod

public fn EnsureAdditionalCapacity(int32 additional) : void

Reserves room for the current byte length plus additional without appending text.

StringBuilder.wax:103

Appendmethod

public fn Append(string value) : void

Copies the UTF-8 bytes of a string onto the end; an empty string does nothing.

StringBuilder.wax:129

AppendSlicemethod

public fn AppendSlice(StringSlice value) : void

Copies a borrowed string slice onto the end. The slice is not retained.

StringBuilder.wax:136

AppendBoolmethod

public fn AppendBool(bool value) : void

Appends lowercase true or false.

StringBuilder.wax:158

AppendCharmethod

public fn AppendChar(char value) : void

Appends the UTF-8 encoding of one code point. Surrogates and values above U+10FFFF become U+FFFD.

StringBuilder.wax:167

AppendInt32method

public fn AppendInt32(int32 value) : void

Appends an unsigned base-10 integer without grouping separators.

StringBuilder.wax:234

AppendInt64method

public fn AppendInt64(int64 value) : void

Appends an unsigned base-10 integer without grouping separators.

StringBuilder.wax:241

AppendUInt32method

public fn AppendUInt32(uint32 value) : void

Appends a base-10 integer without grouping separators. Signed values include a leading minus sign when negative.

StringBuilder.wax:264

AppendUInt64method

public fn AppendUInt64(uint64 value) : void

Appends a base-10 integer without grouping separators. Signed values include a leading minus sign when negative.

StringBuilder.wax:272

AppendUInt64Paddedmethod

public fn AppendUInt64Padded(uint64 value, int32 minDigits) : void

Appends unsigned decimal digits padded on the left with zeros to at least minDigits. Existing digits are never truncated.

StringBuilder.wax:290

AppendInt64Paddedmethod

public fn AppendInt64Padded(int64 value, int32 minDigits) : void

Appends decimal digits padded on the left with zeros to at least minDigits. The sign, when present, precedes the zeros and is not counted as a digit. Existing digits are never truncated.

StringBuilder.wax:300

AppendUInt64Hexmethod

public fn AppendUInt64Hex(uint64 value, int32 minDigits, bool upper) : void

Appends hexadecimal digits without a prefix, left-padded with zeros to minDigits. upper selects uppercase A–F; existing digits are never truncated.

StringBuilder.wax:309

AppendUInt64Binarymethod

public fn AppendUInt64Binary(uint64 value, int32 minDigits) : void

Appends binary digits without a prefix, left-padded with zeros to minDigits. Existing digits are never truncated.

StringBuilder.wax:318

AppendFloatmethod

public fn AppendFloat(float value) : void

Appends the shortest decimal form that round-trips to the original float value. Uses the float value directly, without first widening to double.

StringBuilder.wax:329

AppendDoublemethod

public fn AppendDouble(double value) : void

Appends the shortest decimal form that round-trips to the original double value.

StringBuilder.wax:337

AppendDoubleFixedmethod

public fn AppendDoubleFixed(double value, int32 precision) : void

Appends fixed-point text with exactly precision fractional digits. Supply a nonnegative precision and allow sufficient memory for the result. NaN and infinities use their special text forms.

StringBuilder.wax:356

AppendDoubleExpmethod

public fn AppendDoubleExp(double value, int32 precision) : void

Appends scientific text with exactly precision fractional digits and a lowercase e. Supply a nonnegative precision and allow sufficient memory for the result. NaN and infinities use their special text forms.

StringBuilder.wax:366

AppendDoubleGmethod

public fn AppendDoubleG(double value, int32 precision) : void

Appends general-format text with precision significant digits, choosing fixed or scientific notation and trimming trailing fractional zeros. Supply a nonnegative precision and allow sufficient memory for the result. NaN and infinities use their special text forms.

StringBuilder.wax:376

AppendDoubleFormattedmethod

public fn AppendDoubleFormatted(double value, string fmt) : void

Appends using the primitive format-specifier rules documented by NumberText. Precision/width suffixes are capped at 99.

StringBuilder.wax:387

AppendFloatFormattedmethod

public fn AppendFloatFormatted(float value, string fmt) : void

Appends using the primitive format-specifier rules documented by NumberText. Precision/width suffixes are capped at 99.

StringBuilder.wax:395

AppendSignedFormattedmethod

public fn AppendSignedFormatted(int64 signedVal, uint64 hexBits, string fmt) : void

Appends using the primitive format-specifier rules documented by NumberText. Precision/width suffixes are capped at 99. For signed hexadecimal/binary output, hexBits is the zero-extended bit pattern at the original integer width.

StringBuilder.wax:404

AppendUnsignedFormattedmethod

public fn AppendUnsignedFormatted(uint64 value, string fmt) : void

Appends using the primitive format-specifier rules documented by NumberText. Precision/width suffixes are capped at 99.

StringBuilder.wax:412

ToStringmethod

public override fn ToString() : string

Copies the current UTF-8 content into an independent immutable string. Later builder edits do not affect it.

StringBuilder.wax:447

Clearmethod

public fn Clear() : void

Resets the byte length to zero while retaining allocated capacity.

StringBuilder.wax:454

Insertmethod

public fn Insert(int32 index, string value) : void

Inserts at a byte offset clamped to [0, length]. A nonempty insertion must occur at a UTF-8 code-point boundary or it panics before changing the text. An empty value does nothing.

StringBuilder.wax:463

Removemethod

public fn Remove(int32 start, int32 length) : void

Removes a byte range: negative start becomes zero, a start past the end or nonpositive length does nothing, and an excessive length is clamped. The clamped endpoints must be UTF-8 code-point boundaries or it panics before changing the text.

StringBuilder.wax:489