Parse a string as a long double value.
Synopsis
Declared in <bslstl_string.h>
long double
stold(
string const& str,
std::size_t* pos = 0);
Description
Parses str interpreting its contents as a floating point number. In C++11 if the number in str is prefixed with 0x or 0X the string will be interpreted as a hex number. If there is no leading 0x or 0X the string will be interpreted as a decimal number. Optionally specify pos whose value is set to the position of the next character after the numerical value. The function ignores leading white space characters and interprets as many characters possible to form a valid floating point number. If no conversion could be performed, then an invalid_argument exception is thrown. If the value read is out of range of the return type, then an out_of_range exception is thrown.
Return Value
long double value parsed from str
Parameters
Name |
Description |
str |
string to parse |
pos |
optional output for the index after the parsed value |
Created with MrDocs