Videos
Hi, I always read about escaping, but still I don't understand very well what does that means. Can someone explain it to me? I'm a beginner, thank you
You can find the full list here.
\tInsert a tab in the text at this point.\bInsert a backspace in the text at this point.\nInsert a newline in the text at this point.\rInsert a carriage return in the text at this point.\fInsert a formfeed in the text at this point.\sInsert a space in the text at this point.\'Insert a single quote character in the text at this point.\"Insert a double quote character in the text at this point.\\Insert a backslash character in the text at this point.
Java Escape Sequences:
\u{0000-FFFF} /* Unicode [Basic Multilingual Plane only, see below] hex value
does not handle unicode values higher than 0xFFFF (65535),
the high surrogate has to be separate: \uD852\uDF62
Four hex characters only (no variable width) */
\b /* \u0008: backspace (BS) */
\t /* \u0009: horizontal tab (HT) */
\n /* \u000a: linefeed (LF) */
\f /* \u000c: form feed (FF) */
\r /* \u000d: carriage return (CR) */
\" /* \u0022: double quote (") */
\' /* \u0027: single quote (') */
\\ /* \u005c: backslash (\) */
\{0-377} /* \u0000 to \u00ff: from octal value
1 to 3 octal digits (variable width) */
The Basic Multilingual Plane is the unicode values from 0x0000 - 0xFFFF (0 - 65535). Additional planes can only be specified in Java by multiple characters: the egyptian heiroglyph A054 (laying down dude) is U+1303F / 𓀿 and would have to be broken into "\uD80C\uDC3F" (UTF-16) for Java strings. Some other languages support higher planes with "\U0001303F".
The backslash is used as a marker character to tell the compiler/interpreter that the next character has some special meaning. What that next character means is up to the implementation. For example C-style languages use \n to mean newline and \t to mean tab.
The use of the word "escape" really means to temporarily escape out of parsing the text and into a another mode where the subsequent character is treated differently.
:))
It is a term related to that of an escape sequence and an Esc (escape) key.
The character itself isn't "running away" from any other character. One might say the character following the escape character (say, \n from your example) escapes the fate of being used as an ordinary n in some application, and is used instead as a newline.