Import with #import "std/number_text".

FormatInteger :: (value: s64, output: []u8) -> string

A whole number in base ten. The buffer needs 21 bytes for any s64.

IntegerPrefix :: (text: string) -> (s64, s64)

The whole number in base ten that starts `text`, and how many bytes it spans: "42x" is 42 over 2 bytes. The count is 0 when `text` does not start with a number or its digits do not fit in an s64.

FormatDecimal :: (value: float64, places: s32, output: []u8) -> string

A number rounded to `places` digits after the point (at most 9), with trailing zeros dropped: 0.5, 12, -3.25. The buffer needs 32 bytes.

Source ↗ · All modules