Expand description
Formatting utilities for numbers.
These functions are low-level, but are designed to be extremely fast for their designed use cases. They have strict requirements, and may not return the most ergonomic types to avoid unnecessary allocations and copying.
Structsยง
- Stack
Str ๐ - A string type with a maximum length known at compile time, stored on the stack.
Staticsยง
- SINGLE_
DIGITS ๐ - SPACE_
PADDED_ ๐PAIRS formatting - ZERO_
PADDED_ ๐PAIRS
Functionsยง
- div_100 ๐
- five_
digits_ ๐zero_ padded formatting - Obtain three strings which together represent
n. The first string is the most significant. Leading zeros are included if the number has fewer than 5 digits. The first string will be empty ifnis less than 10,000. - four_
digits_ ๐space_ padded formatting - Obtain two strings of two ASCII digits each representing
n. The first string is the most significant. Leading spaces are included if the number has fewer than 4 digits. - four_
digits_ ๐zero_ padded - Obtain two strings of two ASCII digits each representing
n. The first string is the most significant. Leading zeros are included if the number has fewer than 4 digits. - four_
to_ ๐six_ digits - Obtain three strings which together represent
n. The first string is the most significant. Leading zeros are included if the number has fewer than 4 digits. The first string will be empty ifnis less than 10,000. - one_
to_ ๐four_ digits_ no_ padding formatting - Obtain two strings of ASCII digits representing
n. The first string is the most significant. No leading zeros or spaces are included. - one_
to_ ๐three_ digits_ no_ padding formatting - Obtain two strings of ASCII digits representing
n. The first string is most significant. No leading zeros or spaces are included. - one_
to_ ๐two_ digits_ no_ padding - Obtain a string of one or two ASCII digits representing
n. No leading zeros or spaces are included. - single_
digit ๐ - Obtain a string containing a single ASCII digit representing
n. - six_
digits_ ๐zero_ padded formatting - Obtain three strings which together represent
n. The first string is the most significant. Leading zeroes are included if the number has fewer than 6 digits. - str_
from_ ๐ โraw_ parts - Safety
- subsecond_
from_ ๐nanos - Obtain five strings which together represent
n, which is a number of nanoseconds. - three_
digits_ ๐space_ padded formatting - Obtain two strings of ASCII digits representing
n. The first string is the most significant. Leading spaces are included if the number has fewer than 3 digits. - three_
digits_ ๐zero_ padded formatting - Obtain two strings of ASCII digits representing
n. The first string is the most significant. Leading zeros are included if the number has fewer than 3 digits. - truncated_
subsecond_ ๐from_ nanos - Obtain a string of 1 to 9 ASCII digits representing
n, which is a number of nanoseconds. - two_
digits_ ๐space_ padded formatting - Obtain a string of two ASCII digits representing
n. This includes a leading space ifnis less than 10. - two_
digits_ ๐zero_ padded - Obtain a string of two ASCII digits representing
n. This includes a leading zero ifnis less than 10.