CompiletimeSI.parseSI

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

mixintemplate CompiletimeSI(N)
Q
parseSI
(
Q
S
)
(
S str
)
if (
isSomeString!S
)

Parameters

Q

the type of the returned quantity.

str S

the string to parse.

Examples

alias Time = typeof(second);
Time t = parseSI!Time("90 min");
assert(t == 90 * minute);
t = parseSI!Time("h");
assert(t == 1 * hour);

Meta