October 5, 1999 - Escape Sequences
October 5, 1999 Escape Sequences Tips: October 1999
Yehuda Shiran, Ph.D.
|
Escape Sequence | Meaning |
\ddd | octal byte (3 digits: ddd ) |
\xdd | hexadecimal byte (2 digits: dd ) |
\\ | backslash |
\' | single quote |
\" | double quote |
\b | backspace |
\f | form feed |
\n | new line |
\r | carriage return |
\t | horizontal tab |
Be sure to use these inline characters only when needed. The behavior of some of them is not so intuitive. The carriage return escape sequence, for example, creates a new line only in dialog boxes and text areas.
Here are some strings that use these escape sequences:
"\x2499.99" // $99.99 (the hex value of the $ character is 24)
'c:\\games\\sc2000\\' // c:\games\sc2000\
'Let\'s learn JavaScript...' // Let's learn JavaScript...