Common escape characters

Source: Internet
Author: User

All ASCII codes can be represented by a "\" plus a number (typically a 8 binary number). and C in the definition of some letters before the "\" to indicate the common ones can not display ASCII characters, such as \0,\t,\n, etc., is called the escape character, because the subsequent character, is not its original ASCII character meaning.
Escape character meaning ASCII code value (decimal)
\a Bell (BEL) 007
\b (BS) 008
\f page Break (FF) 012
\ nthe line break (LF) 010
\ r Enter (CR) 013
\ t Horizontal tab (HT) 009
\v Vertical Tabulation (VT) 011
\ \ back Slash 092
\? Question mark character 063
\ ' single quote character 039
\ "Double quote character 034
000 null character (NULL)
\DDD any character three-bit octal
\xhh any character two-bit hex
Character-type constants
The value represented by a character constant is the value that a character variable can contain. We can use an ASCII expression to represent a character constant, or an escape character with a backslash in single quotation marks.
' A ', ' \x2f ', ' \013 ';
Where: \x indicates that the following character is a hexadecimal number, and that the following character is an octal number.
Note: In Turbo C 2.0, the number of character constant representations ranges from 128 to 127 unless you declare it as unsigned, which is 0 to 255.
The \x,\n,\a we see above are called escape characters, which tells the compiler that it needs to be handled in a special way. The following gives all the escape characters and their corresponding meanings:
Escape Character Description
\ ' Single quotation mark
\ double quotation marks
\ \ counter Slash
Space-out character
\CCC (up to three digits) octal number
\a Sound Notes
\b Backspace
\f Page Break
\ n line break
\ r return character
\ t Horizontal tab
\v Vertical Tab
\XHH (up to two bits) hexadecimal characters various programming language escape characters such as HTML escape character, Java escape character, XML escape character, Oracle escape character, SQL escape character, SQL Server escape character, PHP escape character, ASP escape character, VB escape character, JavaScript Escape character, and so on, and the percent symbol in the URL.
For example, the  < of HTML > & & "&copy
There are only 5 of the XML: &lt; &gt; & &amp; &quot; &apos; XML No &nbsp; Why should I use an escape stringEscape String(Escape Sequence) is also known as the character entity (Character entity). In HTML, there are two reasons for defining an escaped string: The first reason is that symbols such as "<" and ">" are already used to represent HTML tags, so they cannot be used directly as symbols in text. In order to use these symbols in an HTML document, you need to define its escape string. When the interpreter encounters such a string, it interprets it as a real character. When you enter an escaped string, you strictly follow the rules for letter-case. The second reason is that some characters are not defined in the ASCII character set, so you need to use an escape string to represent them. The escaped string consists of an escape string (Escape Sequence), which is a character entity (Character entity) divided into three parts: the first part is a & symbol, English is called Ampersand; the second part is the entity name or # Add the entity number, and the third part is a semicolon.
For example, to display a less than sign (<), you can write &lt; or <.
The advantage of the entity name is better understanding, a look at LT, probably guess is less than meaning, but its disadvantage is that not all browsers support the latest Entity name. The entity number can be processed by various browsers.
Tip: Entity names (entities) are case-sensitive.
Note: The same symbol can be referenced in both "Entity name" and "entity number", "Entity name" advantage is easy to remember, but does not guarantee that all browsers will be able to identify it, and "entity number" There is no such worry, but it is not easy to remember.   How do i show spaces? In general, HTML automatically truncates extra spaces. No matter how many spaces you add, it's considered a space. For example, if you add 10 spaces between two characters, the HTML will truncate 9 spaces, leaving only one. To add spaces to the page, you can use &nbsp; to represent spaces. JavaScript escape character escape sequence characters
\b Backspace
\f Paper Change page
\ nthe line break
\ r Enter
\ t transverse jump lattice (ctrl-i)
\ ' Single quotation mark
\ "Double quotation marks
\ \ counter Slash
List of special escape characters

Common escape characters

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.