StringToDouble

将字符串转变成数字的双精度型

double  StringToDouble(
   string  value      // 字符串
   );

参量

[in]  数字的字符串换行格式

返回值

双精度型值

 

示例:

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- 要转换的字符串
   string str = "12345.54321";
//--- 将输入字符串作为实数转换为double型变量
   double converted=StringToDouble(str);
//--- 在日志中显示精确到小数点后8位的结果数字
   PrintFormat("The string '%s' is converted to the real number %.8f"strconverted);
   /*
   result:
   The string '12345.54321is converted to the real number 12345.54321000
   */
  }

另见

NormalizeDouble真实型(双精度,浮点)类型减少