//+------------------------------------------------------------------+
//| 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", str, converted);
/*
result:
The string '12345.54321' is converted to the integer number 12345
*/
}
|