Logo

Programming-Idioms

History of Idiom 22 > diff from v73 to v74

Edit summary for version 74 by Blooser:
New Cpp implementation by user [Blooser]

Version 73

2019-09-26, 21:29:08

Version 74

2019-09-26, 22:06:28

Idiom #22 Convert string to integer

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

Illustration

Idiom #22 Convert string to integer

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

Illustration
Extra Keywords
int base conversion
Extra Keywords
int base conversion
Imports
#include <string>
#include <sstream>
Code
std::stringstream ss(str);
int i;
ss >> i;