JScript escape characters
Previous  Top  Next


JScript provides escape sequences that you can include in strings to create characters that you cannot type directly. Each of these sequences begins with a backslash. The backslash is an escape character that informs the JScript interpreter that the next character is special.

   Escape sequence   Meaning   

   \b         Backspace   
   \f         Form feed (rarely used)   
   \n         Line feed (newline)   
   \r         Carriage return. Use with the line feed (\r\n) to format output.   
   \t         Horizontal tab   
   \v         Vertical tab (rarely used)   
   \'         Single quote (')   
   \"         Double quote (")   
   \\         Backslash (\)   
   \n         ASCII character represented by the octal number n. *
   \xhh         ASCII character represented by the two-digit hexadecimal number hh.    
   \uhhhh         Unicode character represented by the four-digit hexadecimal number hhhh.

* The value of n must be in the range 0 to 377 (octal).
   
Any escape sequence not included in this table simply codes for the character that follows the backslash in the escape sequence. For example, "\a" is interpreted as "a".

Since the backslash itself represents the start of an escape sequence, you cannot directly type one in your script.

If you want to include a backslash, you must type two sequential characters (\\).

For example. 'The log file path is C:\\Program Files\\Syslogd\\Logs\\SyslogCatchAll.txt'

The single quote and double quote escape sequences can be used to include quotes in string literals.

For example. 'The caption reads, \"This is a test message from \'Kiwi SyslogGen\'.\"'