Logo

Programming-Idioms

History of Idiom 22 > diff from v28 to v29

Edit summary for version 29 by :
[D] Comment emphasize

Version 28

2015-12-30, 21:25:14

Version 29

2015-12-30, 21:26:58

Idiom #22 Convert string to integer

Extract integer value i from its string representation s (in radix 10)

Idiom #22 Convert string to integer

Extract integer value i from its string representation s (in radix 10)

Imports
import std.conv;
Imports
import std.conv;
Code
auto i = s.to!int;
Code
auto i = s.to!int;
Comments bubble
the extremely useful 'to' function can convert just about anything to something else. It will throw on a non-integral input string.
Comments bubble
The useful to function can convert just about anything to something else. It will throw on a non-integral input string.