Backslash escapes
Dan Tobias (Talk | contribs) (Created page with "{{FormatInfo |formattype=electronic |subcat=Character encoding |wikidata={{wikidata|Q1366300}}, {{wikidata|Q17077094}} }} '''Backslash escapes''' are one of the methods variou...") |
Dan Tobias (Talk | contribs) |
||
Line 43: | Line 43: | ||
|} | |} | ||
− | Some additions and variations may be used in different systems. Often \e stands for the escape character (ESC, 1B), though this is not one of the official standard C escapes. The newline (\n) might get translated to a system-specific line break sequence such as CR or CR+LF. | + | Some additions and variations may be used in different systems. Often \e stands for the escape character (ESC, 1B), though this is not one of the official standard C escapes. The newline (\n) might get translated to a system-specific line break sequence such as CR or CR+LF. Various other characters that have syntactic meanings in programming languages or regular-expression parsers, like forward slashes, semicolons, and asterisks, are often prefixed with backslashes when used as literals. |
== Links == | == Links == | ||
* [[Wikipedia:Escape sequences in C|Wikipedia article]] | * [[Wikipedia:Escape sequences in C|Wikipedia article]] |
Latest revision as of 15:42, 1 July 2019
Backslash escapes are one of the methods various programming, scripting, and markup languages use to allow the inclusion of characters in text strings that might otherwise be difficult or impossible to use, because they have special syntactic meaning, are not part of the currently-used character set, are difficult to type, or are nonprinting characters that don't show in a display. These were introduced in the C programming language, but some version of them is in use in a number of other languages and formats.
These are the standard C backspace escapes:
Escape sequence | Meaning |
---|---|
\a | Alert/beep/bell (BEL, 07) |
\b | Backspace (BS, 08) |
\f | Formfeed (FF, 0C) |
\n | Newline/Linefeed (LF, 0A) |
\r | Carriage Return (CR, 0D) |
\t | Horizontal Tab (HT, 09) |
\v | Vertical Tab (VT, 0B) |
\\ | Backslash (\, 5C) |
\' | Apostrophe/single-quote (', 27) |
\" | Double quote (", 22) |
\? | Question mark (?, 3F) |
\nnn | Byte specified as octal number |
\xhh | Byte specified as hexadecimal number |
\uhhhh | Unicode character (range 0000-FFFF) |
\Uhhhhhhhh | Unicode character (full range) |
Some additions and variations may be used in different systems. Often \e stands for the escape character (ESC, 1B), though this is not one of the official standard C escapes. The newline (\n) might get translated to a system-specific line break sequence such as CR or CR+LF. Various other characters that have syntactic meanings in programming languages or regular-expression parsers, like forward slashes, semicolons, and asterisks, are often prefixed with backslashes when used as literals.