The OpenD Programming Language

unformatValue

Reads a value from the given input range and converts it according to a format specifier.

T
unformatValue
(
T
Range
Char
)
(
ref Range input
,
scope const ref FormatSpec!Char spec
)

Parameters

input Range

the input range, to read from

spec FormatSpec!Char
T

type to return

Range

the type of the input range input

Char

the character type used for spec

Return Value

Type: T

A value from input of type T.

Throws

A FormatException if reading did not succeed.

Examples

import std.format.spec : singleSpec;

string s = "42";
auto spec = singleSpec("%s");
assert(unformatValue!int(s, spec) == 42);

See Also

Meta