ShortArrayToString

把数组的复制部分转到返回字符串。

string  ShortArrayToString(
   ushort  array[],      // 数组
   int     start=0,      // 数组中的启动位置
   int     count=-1      // 交易品种数
   );

参量

array[]

[in]  无符号短整型数组(模拟wchar_t 型)

start=0

[in] 位置,从复制开始起,默认是0

count=-1

[in]  复制的数组元素数字,定义结果字符串的长度,默认值是-1,表示复制到数组末尾,否则客户端仍旧是0

返回值

字符串。

 

示例:

#define ROW_SIZE 16
 
ushort ExtShortArray[]={0x2190,0x2191,0x2192,0x2193,0x2194,0x2195,0x2196,0x2197,0x2198,0x2199,0x219A,0x219B,0x219C,0x219D,0x219E,0x219F,
                        0x21A0,0x21A1,0x21A2,0x21A3,0x21A4,0x21A5,0x21A6,0x21A7,0x21A8,0x21A9,0x21AA,0x21AB,0x21AC,0x21AD,0x21AE,0x21AF,
                        0x21B0,0x21B1,0x21B2,0x21B3,0x21B4,0x21B5,0x21B6,0x21B7,0x21B8,0x21B9,0x21BA,0x21BB,0x21BC,0x21BD,0x21BE,0x21BF,
                        0x21C0,0x21C1,0x21C2,0x21C3,0x21C4,0x21C5,0x21C6,0x21C7,0x21C8,0x21C9,0x21CA,0x21CB,0x21CC,0x21CD,0x21CE,0x21CF,
                        0x21D0,0x21D1,0x21D2,0x21D3,0x21D4,0x21D5,0x21D6,0x21D7,0x21D8,0x21D9,0x21DA,0x21DB,0x21DC,0x21DD,0x21DE,0x21DF,
                        0x21E0,0x21E1,0x21E2,0x21E3,0x21E4,0x21E5,0x21E6,0x21E7,0x21E8,0x21E9,0x21EA,0x21EB,0x21EC,0x21ED,0x21EE,0x21EF,
                        0x21F0,0x21F1,0x21F2,0x21F3,0x21F4,0x21F5,0x21F6,0x21F7,0x21F8,0x21F9,0x21FA,0x21FB,0x21FC,0x21FD,0x21FE,0x21FF};
 
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- 计算7x16交易品种表中的字符串数量
   int total=(int)ExtShortArray.Size()/ROW_SIZE;
//--- 在表格行的循环中,显示7组箭头,每行16个Unicode字符,逐行显示到日志中
   for(int i=0i<totali++)
     {
      int row=i*ROW_SIZE;
      PrintFormat("Arrow set %u: %s",i+1,ShortArrayToString(ExtShortArray,row,ROW_SIZE));
     }
   /*
   result:
   Arrow set 1: ←↑→↓↔↕�I�J�K�L↚↛↜↝↞↟
   Arrow set 2: ↠↡↢↣↤↥↦↧↨↩↪↫↬↭↮↯
   Arrow set 3: ↰↱↲↳↴↵↶↷↸↹↺↻↼↽↾↿
   Arrow set 4: ⇀⇁⇂⇃⇄⇅⇆⇇⇈⇉⇊⇋⇌⇍⇎⇏
   Arrow set 5: ⇐⇑⇒⇓⇔⇕⇖⇗⇘⇙⇚⇛⇜⇝⇞⇟
   Arrow set 6: ⇠⇡⇢⇣⇤⇥⇦⇧⇨⇩⇪⇫⇬⇭⇮⇯
   Arrow set 7: ⇰⇱⇲⇳⇴⇵⇶⇷⇸⇹⇺⇻⇼⇽⇾⇿
   */
  }

另见

StringToShortArrayCharArrayToString代码页使用