← Standard library

NumberText

static class NumberText
import NumberText from Wax;

Locale-independent primitive formatting. Floating forms support F/f (fixed, default 2 fractional digits), E/e (scientific, default 6), and G/g (general, default 6 significant digits for doubles). Other double forms use shortest round-trip text; floats also use shortest form for an empty spec or G/g without precision. Integers support X/x hexadecimal and B/b binary; other letters use decimal. Decimal suffixes give precision or minimum integer digits and are capped at 99. String-returning helpers reuse scratch storage and must not be called concurrently or reentrantly; span writers use caller-owned storage.

NumberText.wax:32

Inherits from object. Follow these links for inherited members.

Members

DoubleToStringmethod

public static fn DoubleToString(double v) : string

Creates a string in shortest round-trip form for the original floating-point type, including special values. Uses shared formatting scratch storage.

NumberText.wax:44

FloatToStringmethod

public static fn FloatToString(float v) : string

Creates a string in shortest round-trip form for the original floating-point type, including special values. Uses shared formatting scratch storage.

NumberText.wax:53

DoubleToStringFmtmethod

public static fn DoubleToStringFmt(double v, string fmt) : string

Creates a string using the type-level format rules and shared scratch storage.

NumberText.wax:61

FloatToStringFmtmethod

public static fn FloatToStringFmt(float v, string fmt) : string

Creates a string using the type-level format rules and shared scratch storage.

NumberText.wax:69

SignedToStringmethod

public static fn SignedToString(int64 v) : string

Creates ungrouped base-10 integer text using shared formatting scratch storage.

NumberText.wax:79

UnsignedToStringmethod

public static fn UnsignedToString(uint64 v) : string

Creates ungrouped base-10 integer text using shared formatting scratch storage.

NumberText.wax:87

SignedToStringFmtmethod

public static fn SignedToStringFmt(int64 signedVal, uint64 hexBits, string fmt) : string

Creates a string using the type-level format rules. Uses shared scratch storage. Signed hexadecimal/binary forms use hexBits, the original-width unsigned bit pattern.

NumberText.wax:98

UnsignedToStringFmtmethod

public static fn UnsignedToStringFmt(uint64 v, string fmt) : string

Creates a string using the type-level format rules and shared scratch storage.

NumberText.wax:106

DoubleFormatIntomethod

public static fn DoubleFormatInto(Span<uint8> buf, double v, string fmt) : int32

Formats at the start of a caller-owned byte span and returns the number of bytes written, without a terminator. Provide enough space for the entire result; insufficient space can panic after partial writes. Format rules are described on NumberText.

NumberText.wax:118

FloatFormatIntomethod

public static fn FloatFormatInto(Span<uint8> buf, float v, string fmt) : int32

Formats at the start of a caller-owned byte span and returns the number of bytes written, without a terminator. Provide enough space for the entire result; insufficient space can panic after partial writes. Format rules are described on NumberText.

NumberText.wax:144

SignedFormatIntomethod

public static fn SignedFormatInto(Span<uint8> buf, int64 signedVal, uint64 hexBits, string fmt) : int32

Formats at the start of a caller-owned byte span and returns the number of bytes written, without a terminator. Provide enough space for the entire result; insufficient space can panic after partial writes. Format rules are described on NumberText. hexBits supplies the original-width unsigned pattern for signed hexadecimal/binary output.

NumberText.wax:159

UnsignedFormatIntomethod

public static fn UnsignedFormatInto(Span<uint8> buf, uint64 v, string fmt) : int32

Formats at the start of a caller-owned byte span and returns the number of bytes written, without a terminator. Provide enough space for the entire result; insufficient space can panic after partial writes. Format rules are described on NumberText.

NumberText.wax:174

WriteUnsignedDecimalmethod

public static fn WriteUnsignedDecimal(Span<uint8> buf, int32 at, uint64 value, int32 minDigits) : int32

Writes unsigned decimal digits at byte offset at, padding to minDigits without truncating, and returns the number of bytes written. No terminator is written. The caller must supply enough writable space; insufficient space can leave a partial result.

NumberText.wax:194

WriteSignedDecimalmethod

public static fn WriteSignedDecimal(Span<uint8> buf, int32 at, int64 value, int32 minDigits) : int32

Writes signed decimal digits at byte offset at, padding to minDigits without truncating, and returns the number of bytes written. The signed minus sign precedes any padding. No terminator is written. The caller must supply enough writable space; insufficient space can leave a partial result.

NumberText.wax:207

WriteHexmethod

public static fn WriteHex(Span<uint8> buf, int32 at, uint64 value, int32 minDigits, bool upper) : int32

Writes hexadecimal digits at byte offset at, padding to minDigits without truncating, and returns the number of bytes written. No terminator is written. The caller must supply enough writable space; insufficient space can leave a partial result. upper selects uppercase hexadecimal letters.

NumberText.wax:227

WriteBinarymethod

public static fn WriteBinary(Span<uint8> buf, int32 at, uint64 value, int32 minDigits) : int32

Writes binary digits at byte offset at, padding to minDigits without truncating, and returns the number of bytes written. No terminator is written. The caller must supply enough writable space; insufficient space can leave a partial result.

NumberText.wax:246