View source code
Display the source code in std/format/read.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.


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


input the input range, to read from
spec a format string
T type to return
Range the type of the input range input
Char the character type used for spec


A value from input of type T.


A FormatException if reading did not succeed.

See Also

parse and to


import std.format.spec : singleSpec;

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


Walter Bright, Andrei Alexandrescu, and Kenji Hara


Boost License 1.0.