View source code
							
							
						
								Display the source code in std/format.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.
							
						Function std.format.unformatValue
Reads a value from the given input range according to spec
 and returns it as type T.
						
					
				Parameters
| Name | Description | 
|---|---|
| T | the type to return | 
| input | the input range to read from | 
| spec | the FormatSpecto use when reading frominput | 
Returns
A value from input of type T
Throws
A FormatException if spec cannot read a type T
See Also
Example
Booleans
auto str = "false";
auto spec = singleSpec("%s");
writeln(unformatValue!bool(str, spec)); // false
str = "1";
spec = singleSpec("%d");
assert(unformatValue!bool(str, spec));
Example
Null values
auto str = "null";
auto spec = singleSpec("%s");
writeln(strExample
Integrals
auto str = "123";
auto spec = singleSpec("%s");
writeln(strExample
Floating point numbers
import stdExample
Character input ranges
auto str = "aaa";
auto spec = singleSpec("%s");
writeln(strExample
Arrays and static arrays
string str = "aaa";
auto spec = singleSpec("%s");
writeln(strExample
Associative arrays
auto str = `["one": 1, "two": 2]`;
auto spec = singleSpec("%s");
writeln(strAuthors
Walter Bright, Andrei Alexandrescu, and Kenji Hara
License
					Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.