Programming language-Escape character

Source: Internet
Author: User
Escape character
The character representation is to add a single quotation mark on both sides of a single character, such as ' 1 ', ' a '.
Escape character, which is like counter switch, trickery. On the road to see a handsome guy walking around on the road, suspected bad, but the leader came out, the original is a bodyguard Ah. You see in the intersection there is a serene old man, the thief came, people get up to do waving fist, do a kung fu old man.
Escape character, similar to the above scenario, it looks like a character, in fact, people do not do the character of the work.
Common escape characters are as follows:
\ n, which means line break. When you use Word, press ENTER to start another line. \ n is the wordless style of the ENTER key.
\ t, which represents the tabulation. Use the TAB key in your document.
\ \, which means backslash \, if you want to use a single backslash in your program, use \ \. For example, to use the \ and n string, if "\ n" is used, the system automatically considers it to be an escape character wrap, so only "\\n" can be used.
\ ', a single quotation mark, if you want to use single quotation marks in the program to play a role, using ", the program is not aware of it, can not function properly. However, if you use ' \ ', this can represent the correct English single quotation mark ', note that this is the Chinese single quotation mark ', the programming world, at least at present, cannot parse the Chinese form symbol.

\ ", which means double quotes, through single quotation marks \ ', is easy to understand \", if you want to use double quotes in your program, you must use \ ". For example "\" \ "nihao\" \ "", which means "Nihao" ", note Nihao before and after each is two double quotes.


Why do I have an escape character?

The escape character is the use of converting a character that has a special purpose into a normal word. For example to use in the program ' and ', ' and ' itself already represents the character and string functions, such as "ni" Hao ", where" ni "is a string, Hao", there is no double quotation marks, followed by no, so if we want Ni "Hao string, there is no way to express, so if you want to use the" The letter meaning, then need to use \ to escape, that is, the use of the string of other meanings or effects.

If we want to use the handsome bodyguard attribute, then we need to add \, if you want to use the old man's function, also need to add \.


2016-09-20 First Revision

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.