RuntimeSI.siFormat

Format a SI quantity according to a format string known at run time.

mixintemplate RuntimeSI(N)
siFormat

Parameters

format string

The format string. Must start with a format specification for the value of the quantity (a numeric type), that must be followed by the symbol of a SI unit.

quantity QVariant!N

The quantity that must be formatted.

Examples

import std.conv : text;

QVariant!double speed = 12.5 * kilo(meter) / hour;
assert(siFormat("%.2f m/s", speed).text == "3.47 m/s");

Meta