我知道Java中的一些转义字符,例如
\n : Newline
\r : Carriage return
\t : Tab
\\ : Backslash
...
有没有一个完整的清单?
发布于 2015-03-16 02:28:54
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) */
Basic Multilingual Plane是0x0000 - 0xFFFF (0 - 65535)中的Unicode值。额外的平面在Java语言中只能由多个字符来指定:埃及的heiroglyph A054 (铺设dude)是U+1303F
/ 𓀿
,并且必须为Java字符串拆分成"\uD80C\uDC3F"
(UTF-16)。其他一些语言支持"\U0001303F"
的更高层次。
发布于 2017-02-06 18:52:27
这些是用于操作字符串的转义字符。
\t Insert a tab in the text at this point.
\b Insert a backspace in the text at this point.
\n Insert a newline in the text at this point.
\r Insert a carriage return in the text at this point.
\f Insert a form feed 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.
从这里阅读更多关于它们的信息。
http://docs.oracle.com/javase/tutorial/java/data/characters.html
https://stackoverflow.com/questions/1367322
复制相似问题