RuntimeSI.parseSI

Parses a string for a quantity of type Q at run time.

Throws a DimensionException.

mixintemplate RuntimeSI(N)
parseSI
(
S
)
(
S str
)
if (
isSomeString!S
)

Parameters

str S

the string to parse.

Examples

auto t = parseSI("90 min");
assert(t == 90 * minute);
t = parseSI("h");
assert(t == 1 * hour);

auto v = parseSI("2");
assert(v == (2 * meter) / meter);

Meta