Namespaces
Variants
Views
Actions

std::stoi, std::stol, std::stoll

From cppreference.com
< cpp‎ | string‎ | basic string
Revision as of 12:57, 16 August 2011 by P12 (Talk | contribs)

Template:cpp/string/sidebar Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <string>
</td>

<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

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.

See also

Template:cpp/string/dcl list stoulTemplate:cpp/string/dcl list stof