std::stoi, std::stol, std::stoll
From cppreference.com
Template:cpp/string/sidebar Template:ddcl list begin <tr class="t-dsc-header">
<td>Defined in header
</td>
<string>
<td></td> <td></td> </tr> <tr class="t-dcl ">
<td >int stoi ( const std::string& str, size_t *idx = 0, int base = 10 );
</td>
<td > (1) </td> <td > Template:mark c++11 feature </td> </tr> <tr class="t-dcl ">
<td >long stol ( const std::string& str, size_t *idx = 0, int base = 10 );
</td>
<td > (2) </td> <td > Template:mark c++11 feature </td> </tr> <tr class="t-dcl ">
<td >long long stoll( const std::string& str, size_t *idx = 0, int base = 10 );
</td>
<td > (3) </td> <td > Template:mark c++11 feature </td> </tr> Template:ddcl list end
This section is incomplete |
Contents |
Parameters
str | - | the string to convert |
pos | - | address of an integer to store the index of the first unconverted character |
base | - | the number base |
Return value
The string converted to the specified signed integer type.
Exceptions
Template:cpp if no conversion could be performed
Template:cpp if the converted value would fall out of the range of the result type.