Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Escape sequence
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Samples=== For example, the single quotation mark character might be expressed as <code><nowiki>'\''</nowiki></code> since writing <code><nowiki>'''</nowiki></code> is not acceptable. Many modern programming languages specify the doublequote character (<code><nowiki>"</nowiki></code>) as a [[delimiter]] for a string literal. The backslash escape character typically provides ways to include doublequotes inside a string literal, such as by modifying the meaning of the doublequote character embedded in the string (<code><nowiki>\"</nowiki></code>), or by modifying the meaning of a sequence of characters including the hexadecimal value of a doublequote character (<code><nowiki>\x22</nowiki></code>). Both sequences encode a literal doublequote (<code><nowiki>"</nowiki></code>). In [[Perl]] or [[Python (programming language)|Python]] 2 <syntaxhighlight lang="perl"> print "Nancy said "Hello World!" to the crowd."; </syntaxhighlight> produces a syntax error, whereas: <syntaxhighlight lang="perl"> print "Nancy said \"Hello World!\" to the crowd."; ### example of \" </syntaxhighlight> produces the intended output. Another alternative: <syntaxhighlight lang="perl"> print "Nancy said \x22Hello World!\x22 to the crowd."; ### example of \x22 </syntaxhighlight> uses "\x" to indicate the following two characters are hexadecimal digits, "22" being the ASCII value for a doublequote in hexadecimal. [[C (programming language)|C]], [[C++]], [[Java (programming language)|Java]], and [[Ruby (programming language)|Ruby]] all allow exactly the same two backslash escape styles. The [[PostScript]] language and Microsoft [[Rich Text Format]] also use backslash escapes. The [[quoted-printable]] encoding uses the [[equals sign]] as an escape character. [[URL]] and [[URI]] use [[percent-encoding]] to quote characters with a special meaning, as for non-ASCII characters. Another similar (and partially overlapping) syntactic trick is [[stropping (syntax)|stropping]]. Some programming languages also provide other ways to represent special characters in literals, without requiring an escape character (see e.g. [[delimiter collision]]).
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)