【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.2.20 is_str_numeric
Contents
Description
Check and convert a string to a double
Syntax
BOOL is_str_numeric( LPCSTR lpcsz, double * lpVal = NULL, DWORD dwCntrl = 0 )
Parameters
- lpcsz
- [input] string to check and convert
- lpVal
- [output] optional pointer to hold resulting value
- dwCntrl (9.2)
- [input] control bits, enumerated as CVTSTR2NUM_*
Return
true if str is a valid numeric string,otherwise false
Examples
EX1
void is_str_numeric_ex1() { double d = 0; string str = "123.456";//change to "abc" to see different result; bool bRet = is_str_numeric(str , &d); if(bRet) printf("\"%s\" is converted to %f \n" ,str ,d); else printf("\"%s\" can not be converted \n" ,str); }
Remark
See Also
is_str_numeric_integer, is_str_numeric_integer_with_args
Header to Include
origin.h