format_unit(value: i64, type: utf8, unit: utf8) → utf8
Category: [strings](builtinsstrings)_
Render a base-unit value in a chosen literal unit, looking the factor up from a unit type by name — the inverse of literal-unit resolution, so it stays correct if the type's @unit factor changes.
| Parameter | Type | Description | Remarks |
|---|---|---|---|
| value | i64 | The stored value, in the type's base unit. | — |
| type | utf8 | The unit type's dotted name, e.g. "std.ByteSize". | — |
| unit | utf8 | The unit to render in, e.g. "MiB". | — |
| returns | utf8 | The value divided by the unit's factor, suffixed with the unit (e.g. "5 MiB"). | — |
wcl
format_unit(5242880, "std.ByteSize", "MiB") // render bytes as MiB → "5 MiB"