Programming-Idioms

History of Idiom 22 > diff from v64 to v65

Edit summary for version 65 :
New Cpp implementation by user [Jeff]

Version 64

2017-06-06, 15:19:09

Version 65

2017-12-27, 11:55:52

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>
Code
int i = std::stoi(s);
Doc URL
http://en.cppreference.com/w/cpp/string/basic_string/stol
Demo URL
http://coliru.stacked-crooked.com/a/3630bd8b3b6fbad1