StringToInteger

将字符串型转换成整型结果。

long  StringToInteger(
   string  value      // 字符串
   );

参量

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

返回值

整型值

 

示例:

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- 要转换的字符串
   string str = "12345.54321";
//--- 将输入字符串作为数字转换为长整型变量
   long converted=StringToInteger(str);
//--- 在日志中显示获得的数字,小数部分被截断
   PrintFormat("The string '%s' is converted to the integer number %I64d"strconverted);
   /*
   result:
   The string '12345.54321is converted to the integer number 12345
   */
  }

另见

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