NumberText
static class NumberTextimport 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.
Inherits from object. Follow these links for inherited members.
Members
DoubleToStringmethod
public static fn DoubleToString(double v) : stringCreates a string in shortest round-trip form for the original floating-point type, including special values. Uses shared formatting scratch storage.
FloatToStringmethod
public static fn FloatToString(float v) : stringCreates a string in shortest round-trip form for the original floating-point type, including special values. Uses shared formatting scratch storage.
DoubleToStringFmtmethod
public static fn DoubleToStringFmt(double v, string fmt) : stringCreates a string using the type-level format rules and shared scratch storage.
FloatToStringFmtmethod
public static fn FloatToStringFmt(float v, string fmt) : stringCreates a string using the type-level format rules and shared scratch storage.
SignedToStringmethod
public static fn SignedToString(int64 v) : stringCreates ungrouped base-10 integer text using shared formatting scratch storage.
UnsignedToStringmethod
public static fn UnsignedToString(uint64 v) : stringCreates ungrouped base-10 integer text using shared formatting scratch storage.
SignedToStringFmtmethod
public static fn SignedToStringFmt(int64 signedVal, uint64 hexBits, string fmt) : stringCreates a string using the type-level format rules. Uses shared scratch storage. Signed
hexadecimal/binary forms use hexBits, the original-width unsigned bit pattern.
UnsignedToStringFmtmethod
public static fn UnsignedToStringFmt(uint64 v, string fmt) : stringCreates a string using the type-level format rules and shared scratch storage.
DoubleFormatIntomethod
public static fn DoubleFormatInto(Span<uint8> buf, double v, string fmt) : int32Formats 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.
FloatFormatIntomethod
public static fn FloatFormatInto(Span<uint8> buf, float v, string fmt) : int32Formats 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.
SignedFormatIntomethod
public static fn SignedFormatInto(Span<uint8> buf, int64 signedVal, uint64 hexBits, string fmt) : int32Formats 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.
UnsignedFormatIntomethod
public static fn UnsignedFormatInto(Span<uint8> buf, uint64 v, string fmt) : int32Formats 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.
WriteUnsignedDecimalmethod
public static fn WriteUnsignedDecimal(Span<uint8> buf, int32 at, uint64 value, int32 minDigits) : int32Writes 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.
WriteSignedDecimalmethod
public static fn WriteSignedDecimal(Span<uint8> buf, int32 at, int64 value, int32 minDigits) : int32Writes 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.
WriteHexmethod
public static fn WriteHex(Span<uint8> buf, int32 at, uint64 value, int32 minDigits, bool upper) : int32Writes 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.
WriteBinarymethod
public static fn WriteBinary(Span<uint8> buf, int32 at, uint64 value, int32 minDigits) : int32Writes 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.