首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >所有的转义字符都是什么?

所有的转义字符都是什么?
EN

Stack Overflow用户
提问于 2009-09-02 12:10:46
回答 2查看 544.3K关注 0票数 131

我知道Java中的一些转义字符,例如

代码语言:javascript
复制
\n : Newline
\r : Carriage return
\t : Tab
\\ : Backslash
...

有没有一个完整的清单?

EN

回答 2

Stack Overflow用户

发布于 2015-03-16 02:28:54

代码语言:javascript
复制
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"的更高层次。

票数 46
EN

Stack Overflow用户

发布于 2017-02-06 18:52:27

这些是用于操作字符串的转义字符。

代码语言:javascript
复制
\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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1367322

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档