StringBuilder
sealed class StringBuilderimport 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.
Inherits from object. Follow these links for inherited members.
Members
constructorconstructor
public constructor ()Creates an empty builder without reserving a byte buffer.
WithCapacityconstructor
public constructor WithCapacity (int32 capacity)Creates an empty builder with the requested byte capacity.
lengthgetter
public get length() : int32The number of UTF-8 bytes currently used.
capacitygetter
public get capacity() : int32The allocated byte capacity, which can exceed the current length.
EnsureCapacitymethod
public fn EnsureCapacity(int32 capacity) : voidReserves at least the requested total number of bytes without shrinking or changing the current text.
EnsureAdditionalCapacitymethod
public fn EnsureAdditionalCapacity(int32 additional) : voidReserves room for the current byte length plus additional without appending text.
Appendmethod
public fn Append(string value) : voidCopies the UTF-8 bytes of a string onto the end; an empty string does nothing.
AppendSlicemethod
public fn AppendSlice(StringSlice value) : voidCopies a borrowed string slice onto the end. The slice is not retained.
AppendBoolmethod
public fn AppendBool(bool value) : voidAppends lowercase true or false.
AppendCharmethod
public fn AppendChar(char value) : voidAppends the UTF-8 encoding of one code point. Surrogates and values above U+10FFFF become U+FFFD.
AppendInt32method
public fn AppendInt32(int32 value) : voidAppends an unsigned base-10 integer without grouping separators.
AppendInt64method
public fn AppendInt64(int64 value) : voidAppends an unsigned base-10 integer without grouping separators.
AppendUInt32method
public fn AppendUInt32(uint32 value) : voidAppends a base-10 integer without grouping separators. Signed values include a leading minus sign when negative.
AppendUInt64method
public fn AppendUInt64(uint64 value) : voidAppends a base-10 integer without grouping separators. Signed values include a leading minus sign when negative.
AppendUInt64Paddedmethod
public fn AppendUInt64Padded(uint64 value, int32 minDigits) : voidAppends unsigned decimal digits padded on the left with zeros to at least minDigits.
Existing digits are never truncated.
AppendInt64Paddedmethod
public fn AppendInt64Padded(int64 value, int32 minDigits) : voidAppends 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.
AppendUInt64Hexmethod
public fn AppendUInt64Hex(uint64 value, int32 minDigits, bool upper) : voidAppends hexadecimal digits without a prefix, left-padded with zeros to minDigits. upper
selects uppercase A–F; existing digits are never truncated.
AppendUInt64Binarymethod
public fn AppendUInt64Binary(uint64 value, int32 minDigits) : voidAppends binary digits without a prefix, left-padded with zeros to minDigits. Existing
digits are never truncated.
AppendFloatmethod
public fn AppendFloat(float value) : voidAppends the shortest decimal form that round-trips to the original float value. Uses the float value directly, without first widening to double.
AppendDoublemethod
public fn AppendDouble(double value) : voidAppends the shortest decimal form that round-trips to the original double value.
AppendDoubleFixedmethod
public fn AppendDoubleFixed(double value, int32 precision) : voidAppends 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.
AppendDoubleExpmethod
public fn AppendDoubleExp(double value, int32 precision) : voidAppends 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.
AppendDoubleGmethod
public fn AppendDoubleG(double value, int32 precision) : voidAppends 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.
AppendDoubleFormattedmethod
public fn AppendDoubleFormatted(double value, string fmt) : voidAppends using the primitive format-specifier rules documented by NumberText.
Precision/width suffixes are capped at 99.
AppendFloatFormattedmethod
public fn AppendFloatFormatted(float value, string fmt) : voidAppends using the primitive format-specifier rules documented by NumberText.
Precision/width suffixes are capped at 99.
AppendSignedFormattedmethod
public fn AppendSignedFormatted(int64 signedVal, uint64 hexBits, string fmt) : voidAppends 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.
AppendUnsignedFormattedmethod
public fn AppendUnsignedFormatted(uint64 value, string fmt) : voidAppends using the primitive format-specifier rules documented by NumberText.
Precision/width suffixes are capped at 99.
ToStringmethod
public override fn ToString() : stringCopies the current UTF-8 content into an independent immutable string. Later builder edits do not affect it.
Clearmethod
public fn Clear() : voidResets the byte length to zero while retaining allocated capacity.
Insertmethod
public fn Insert(int32 index, string value) : voidInserts 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.
Removemethod
public fn Remove(int32 start, int32 length) : voidRemoves 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.