Skip to content

ShortToString

ShortToString

It converts the symbol code (unicode) into one-symbol string and returns resulting string.

string  ShortToString(
   ushort  symbol_code      // symbol
   );

Parameters

symbol_code

[in] Symbol code. Instead of a symbol code you can use literal string containing a symbol or a literal string with 2-byte hexadecimal code corresponding to the symbol from the Unicode table.

Return Value

String.

Example:

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- print 18 characters in a loop, starting with the character with the Unicode number of U+23E9
   for(int i=0; i<18; i++)
     {
      ushort code=0x23E9+(ushort)i;
      PrintFormat("Unicode number U+%hX: %s",code,ShortToString(code));
     }
   /*
   result:
   Unicode number U+23E9: &#9193;
   Unicode number U+23EA: &#9194;
   Unicode number U+23EB: &#9195;
   Unicode number U+23EC: &#9196;
   Unicode number U+23ED: &#9197;
   Unicode number U+23EE: &#9198;
   Unicode number U+23EF: &#9199;
   Unicode number U+23F0: &#9200;
   Unicode number U+23F1: &#9201;
   Unicode number U+23F2: &#9202;
   Unicode number U+23F3: &#9203;
   Unicode number U+23F4: &#9204;
   Unicode number U+23F5: &#9205;
   Unicode number U+23F6: &#9206;
   Unicode number U+23F7: &#9207;
   Unicode number U+23F8: &#9208;
   Unicode number U+23F9: &#9209;
   Unicode number U+23FA: &#9210;
   */
  }

See also

StringToCharArray, CharToString, StringGetCharacter

Last updated on