std.fmt
formatInt function
pub fn formatInt(value: int, spec: string): string
stdlib/std/fmt.lyr:20
formatUint function
pub fn formatUint(value: uint, spec: string): string
stdlib/std/fmt.lyr:21
formatFloat function
pub fn formatFloat(value: float, spec: string): string
stdlib/std/fmt.lyr:22
formatBool function
pub fn formatBool(value: bool, spec: string): string
stdlib/std/fmt.lyr:23
formatChar function
pub fn formatChar(value: char, spec: string): string
stdlib/std/fmt.lyr:24
formatString function
pub fn formatString(value: string, spec: string): string
stdlib/std/fmt.lyr:28
formatRadix function
pub fn formatRadix(value: int, radix: int): string
To a base from 2 to 36. Letters from a for digit values above 9.
The inverse of std.string.parseIntRadix. They live in different modules because parsing is
text processing and formatting is output, and std.string must not import std.fmt.
stdlib/std/fmt.lyr:43
formatHex function
pub fn formatHex(value: int): string
stdlib/std/fmt.lyr:77
formatBinary function
pub fn formatBinary(value: int): string
stdlib/std/fmt.lyr:81
formatOctal function
pub fn formatOctal(value: int): string
stdlib/std/fmt.lyr:85
formatHexPadded function
pub fn formatHexPadded(value: int, width: int): string
Hexadecimal with a fixed number of digits and leading zeros: formatHexPadded(255, 4) is
"00ff", for addresses and colour values where the width carries meaning.
stdlib/std/fmt.lyr:91
padLeft function
pub fn padLeft(value: string, width: int): string
stdlib/std/fmt.lyr:97
padRight function
pub fn padRight(value: string, width: int): string
stdlib/std/fmt.lyr:101
center function
pub fn center(value: string, width: int): string
Centres. On an odd remainder the extra character goes to the RIGHT. A decision rather than a matter of course, but without it the same input yields two different results depending on the implementation.
stdlib/std/fmt.lyr:108
formatBytes function
pub fn formatBytes(bytes: int): string
Bytes in readable form: 1536 becomes "1.5 KB".
Base 1024 with the prefixes without i (KB rather than KiB), the spelling operating
systems and tools actually use.
stdlib/std/fmt.lyr:123
table function
pub fn table(rows: string[][], separator: string): string
Aligns columns. Each row is a string[]; short rows are padded with empty cells.
No borders and no header handling: what a table means is the caller's business. This does the tedious part — two passes over the data, to know the column widths before printing.
stdlib/std/fmt.lyr:147