StringToInteger

この関数は数のシンボル表現を含む文字列を long(整数)型の数値に変換します。

long  StringToInteger(
  string  value      // 文字列
  );

パラメータ

value

[in]  数を含む文字列

戻り値

long 型の値

 

例:

//+------------------------------------------------------------------+
//| スクリプトプログラム開始関数                                              |
//+------------------------------------------------------------------+
void OnStart()
 {
//--- 変換する文字列
  string str = "12345.54321";
//--- 入力文字列を数字としてlong型の変数に変換する
  long converted=StringToInteger(str);
//--- 取得した数値を小数部分を切り捨てて操作ログに表示する
  PrintFormat("The string '%s' is converted to the integer number %I64d", str, converted);
  /*
  結果:
  The string '12345.54321' is converted to the integer number 12345
  */
 }

S

参照

IntegerToStringReal 型(double、float)型の削減