Character Escaping
Table of Contents
- Table of Contents
- What is character escaping?
- When to use character escaping
- Commonly used escape sequences
- Examples
What is character escaping?
Character escaping is a technique used to represent characters that have special meaning in a particular context. For example, in programming languages, the backslash (\
) character is used to escape special characters, such as newlines and quotation marks.
When to use character escaping
Character escaping is typically used in the following situations:
- When using the embed parser
- When wanting to use specific characters within functions that would be normally not allowed
Commonly used escape sequences
The following table shows some commonly used escape sequences:
CHARACTER | ESCAPED | ALTERNATIVE |
---|---|---|
[ | #RIGHT# | \[ |
] | #LEFT# | \] |
; | #SEMI# | \; |
: | #COLON# | \: |
$ | #CHAR# | \$ |
< | #RIGHT_CLICK# | \< |
> | #LEFT_CLICK# | \> |
= | #EQUAL# | \= |
{ | #RIGHT_BRACKET# | \{ |
} | #LEFT_BRACKET# | \} |
, | #COMMA# | |
&& | #AND# | \&\& |
|| | #OR# | \\\\ |
NEW LINE | \n |
Examples
Here are some examples of character escaping:
- The
#RIGHT#
escape sequence is used to represent the[
character. - The
\n
escape sequence is used to represent a newline character.