std::strtof, std::strtod, std::strtold

来自cppreference.com

 
 
字符串库
null结尾的字符串
Original:
Null-terminated strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
字节的字符串
多字节字符串
宽字符串
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string
char_traits
 
NULL结尾的字节串
功能
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
字符操作
Original:
Character manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
转换为数字格式
Original:
Conversions to numeric formats
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
strtoul
strtoull
strtof
strtod
strtold
字符串操作
Original:
String manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
strcpy
strncpy
strcat
strncat
strxfrm
字符串检查
Original:
String examination
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
内存操作
Original:
Memory manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
memchr
memcmp
memset
memcpy
memmove
杂项
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
strerror
 
Defined in header <cstdlib>
float       strtof( const char* str, char** str_end );
(C++11 起)
double      strtod( const char* str, char** str_end );
long double strtold( const char* str, char** str_end );
(C++11 起)
。解释浮点值一个字节的字符串所指向的str.
Original:
Interprets a floating point value in a byte string pointed to by str.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
函数丢弃任何空白字符(由std::isspace()),直到找到第一个非空白字符。然后它会尽可能多的字符可能形成一个有效的浮点表示,并将其转换为浮点值。有效浮点值可以是下列之一:
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.
  • 十进制浮点表达。它由以下几部分组成:
    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.
  • (可选的)加号或减号
    Original:
    (可选的) plus or minus sign
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • 可以选择一个的小数点字符(定义尾数)包含的小数位数的非空序列
    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.
  • (可选的)eE可选的负号或加号和非空的十进制数字序列(DEFINES指数)
    Original:
    (可选的) e or E 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.
  • 二进制浮点表达。它由以下几部分组成:
    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.
  • (可选的)加号或减号
    Original:
    (可选的) plus or minus sign
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • 0x or 0X
  • 可以选择一个的小数点字符(定义尾数)包含十六进制数字的非空序列
    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.
  • (可选的)pP可选的负号或加号和非空的十六进制数字序列(DEFINES指数)
    Original:
    (可选的) p or P 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.
  • 无穷的表达。它由以下几部分组成:
    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.
  • (可选的)加号或减号
    Original:
    (可选的) plus or minus sign
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • INFINFINITY忽略大小写
    Original:
    INF or INFINITY ignoring case
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • 没有一个数的表达。它由以下几部分组成:
    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.
  • (可选的)加号或减号
    Original:
    (可选的) plus or minus sign
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • NANNAN(“char_sequence”)忽略大小写的NAN部分。 “char_sequence”只能包含字母数字字符。其结果是一个安静的南浮点值.
    Original:
    NAN or NAN(char_sequence) ignoring case of the NAN 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.
。的功能设置的指针所指向的str_end指向过去的字符的最后一个字符解释。 str_endNULL,被忽视。
Original:
The functions sets the pointer pointed to by str_end to point to the character past the last character interpreted. If str_end is NULL, 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.

[编辑] 。参数。

str -
。 null结尾的字节串的指针进行解释。
Original:
pointer to the null-terminated byte string to be interpreted
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
str_end -
。字符指针的指针.
Original:
pointer to a pointer to character.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

===。 返回值。===

。浮点值对应的成功的内容str。如果转换的值落在相应的返回类型的范围,范围发生错误,HUGE_VALHUGE_VALFHUGE_VALL返回。如果没有可以进行转换,0返回.
Original:
Floating point value corresponding to the contents of str on success. If the converted value falls out of range of corresponding return type, range error occurs and HUGE_VAL, HUGE_VALF or HUGE_VALL is returned. If no conversion can be performed, 0 is returned.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[编辑] 。为例。

[编辑] 。另请参阅。

一个字节的字符串转换为浮点值
Original:
converts a byte string to a 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.

(函数) [edit]
C documentation for strtof, strtod, strtold