std::stof, std::stod, std::stold
Aus cppreference.com
< cpp | string | basic string
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
definiert in Header <string>
|
||
float stof( const std::string& str, size_t *pos = 0 ); |
(1) | (seit C++11) |
double stod( const std::string& str, size_t *pos = 0 ); |
(2) | (seit C++11) |
long double stold( const std::string& str, size_t *pos = 0 ); |
(3) | (seit C++11) |
Legt einen Gleitkommawert in einen String
str
. Original:
Interprets a floating point value in a string
str
. The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Funktion verwirft alle Whitespace-Zeichen (wie std::isspace() bestimmt) bis zum ersten Nicht-Whitespace-Zeichen gefunden wird. Dann dauert es so viele Zeichen wie möglich, um eine gültige Gleitkomma-Darstellung bilden und wandelt sie in Fließkommazahl. Der gültige Gleitkommawert kann eine der folgenden sein:
Original:
Function discards any whitespace characters (as determined by std::isspace()) until first non-whitespace character is found. Then it takes as many characters as possible to form a valid floating point representation and converts them to floating point value. The valid floating point value can be one of the following:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- Gleitpunktberechnungen Ausdruck. Es besteht aus folgenden Teilen:Original:decimal floating point expression. It consists of the following parts:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- (optional) Plus-oder MinuszeichenOriginal:(optional) plus or minus signThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - nichtleere Folge von Dezimalziffern gegebenenfalls ein Dezimalzeichen (definiert Mantisse)Original:nonempty sequence of decimal digits optionally containing a decimal point character (defines significand)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - (optional)
e
oderE
folgte mit optional Minus-oder Pluszeichen und nichtleere Folge von Dezimalziffern (definiert Exponent)Original:(optional)e
orE
followed with optional minus or plus sign and nonempty sequence of decimal digits (defines exponent)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
- binäre Fließkomma-Ausdruck. Es besteht aus folgenden Teilen:Original:binary floating point expression. It consists of the following parts:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- (optional) Plus-oder MinuszeichenOriginal:(optional) plus or minus signThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
0x
or0X
- nichtleere Folge von Hexadezimalziffern gegebenenfalls ein Dezimalzeichen (definiert Mantisse)Original:nonempty sequence of hexadecimal digits optionally containing a decimal point character (defines significand)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - (optional)
p
oderP
folgte mit optional Minus-oder Pluszeichen und nichtleere Folge von Hexadezimalziffern (definiert Exponent)Original:(optional)p
orP
followed with optional minus or plus sign and nonempty sequence of hexadecimal digits (defines exponent)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
- infinity Ausdruck. Es besteht aus folgenden Teilen:Original:infinity expression. It consists of the following parts:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- (optional) Plus-oder MinuszeichenOriginal:(optional) plus or minus signThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
INF
oderINFINITY
ignorieren FallOriginal:INF
orINFINITY
ignoring caseThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
- not-a-number Ausdruck. Es besteht aus folgenden Teilen:Original:not-a-number expression. It consists of the following parts:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- (optional) Plus-oder MinuszeichenOriginal:(optional) plus or minus signThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
NAN
oderNAN(
char_sequence)
ignorieren Fall desNAN
Teil. Char_sequence kann nur alphanumerische Zeichen enthalten. Das Ergebnis ist ein ruhiger NaN Gleitkommawert .Original:NAN
orNAN(
char_sequence)
ignoring case of theNAN
part. char_sequence can only contain alphanumeric characters. The result is a quiet NaN floating point value.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
Der Index des ersten umgesetzten Zeichen wird in
pos
gespeichert. Wenn NULL als pos
übergeben wird, wird es ignoriert .Original:
The index of the first unconverted character is stored in
pos
. If NULL is passed as pos
, it is ignored.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Inhaltsverzeichnis |
[Bearbeiten] Parameter
str | - | die Zeichenfolge zu konvertieren
Original: the string to convert The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
pos | - | Adresse des ganzzahligen den Index des ersten umgesetzten Charakter zu speichern
Original: address of integer to store the index of the first unconverted character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[Bearbeiten] Rückgabewert
Die Zeichenfolge in die angegebene Gleitkommazahl konvertiert .
Original:
The string converted to the specified floating point type.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten] Ausnahmen
std::invalid_argument wenn keine Konvertierung durchgeführt werden konnten
Original:
std::invalid_argument if no conversion could be performed
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
std::out_of_range wenn der konvertierte Wert würde fallen aus dem Bereich der Ergebnis-Typ .
Original:
std::out_of_range if the converted value would fall out of the range of the result type.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten] Siehe auch
(C++11) (C++11) (C++11) |
wandelt einen String in eine Ganzzahl Original: converts a string to an signed integer The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktion) |
(C++11) (C++11) |
wandelt einen String in eine Ganzzahl ohne Vorzeichen Original: converts a string to an unsigned integer The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktion) |