Escape Sequences for String Literals

An escape sequence is a sequence of keystrokes or output characters that begins with the ESC character. Escape sequences are typically used for positioning the cursor and controlling the display of text on the screen, or as codes to control printers.

An escape sequence represents a single character (one byte), and can be any of the following:

 

Escape Sequence

Character Name

Value

\a

Bell

7

\b

Backspace

8

\f

Form feed

12

\n

Newline (Line feed)

10 or 0xa

\r

Carriage return

13 or 0xd

\t

Horizontal tab

9

\v

Vertical tab

11

\'

Single quotation mark

39 or 027

\"

Double quotation mark

34 or 022

\\

Backslash

92 or 05c

\xhhh

Hexadecimal number

0xhhh (i.e. "\x04A" same as "J", "\x00A" same as "\n")

\c where c is any character not found above

Character or numeral

That character. See "Comments" below for "any character".

Comments

Note: For any character, normally you would just type the character without the backslash. For example, to get the letter 'n', just type the letter without the backslash.

Example

To add to your log file the following:

This is an "ATEasy" test.
Second 'Line'

use this:

Print "This is an \"ATEasy\" test.\r\nSecond \'Line\'\x00D\x00A"

See Also

String Literals