Character Constants
Overview
ushort type, with values ranging from 0 to 65535.'0') or as a hexadecimal ASCII code (e.g., '\x10').Definition
'A', '0').\x prefix followed by 1 to 4 hexadecimal characters (e.g., '\xA9', '\x263A').\d prefix followed by a decimal number from 0 to 65535.Escape Sequences
A backslash (\) is used as an escape character for special symbols:
| Character Name | Mnemonic Code/Image | MQL4 Record | Numeric Value |
|---------------------|---------------------|-------------|---------------|
| New Line (Line Feed)| LF | '\n' | 10 |
| Horizontal Tab | HT | '\t' | 9 |
| Carriage Return | CR | '\r' | 13 |
| Backslash | \ | '\\' | 92 |
| Single Quote | ' | '\'' | 39 |
| Double Quote | " | '\"' | 34 |
Data Type and Range
ushort (unsigned short integer).Operations and Usage
+, -) can be applied to character constants.StringSetCharacter().Related Functions
StringSetCharacter()StringGetCharacter()ShortToString()ShortArrayToString()StringToShortArray()Examples
int symbol_0 = '0'; // Assigns the numeric value 30 to symbol_0.int symbol_9 = symbol_0 + 9; // Calculates the numeric value for '9'.string test = "Queen\x2660Ace\x2662"; // Creates a string with Unicode characters.int a = '\xA9'; // Assigns the Unicode value for '©' to variable 'a'.int d = '\xAE'; // Assigns the Unicode value for '®' to variable 'd'.
Previous
arrow_back
Integer types