Java中的所有转义字符是什么? [英] What are all the escape characters in Java?

查看:301
本文介绍了Java中的所有转义字符是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

  \\\
:Newline
\r :回车
\t:Tab
\\:反斜杠
...

有没有完整的列表?

解决方案

你可以找到完整的列表 here




  • \t 此时在文本中插入选项卡。

  • \b 此时在文本中插入退格。

  • \\\
    插入换行符在这一点上的文本中。

  • \r 此时在文本中插入回车。

  • \f 此时在文本中插入换页。

  • \\'此时在文字中插入单引号。

  • \此时在文本中插入一个双引号字符。

  • \\ 在此时的文字。


I know some of the escape characters in Java, e.g.

\n : Newline
\r : Carriage return
\t : Tab
\\ : Backslash
...

Is there a complete list somewhere?

解决方案

You can find the full list here.

  • \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 formfeed 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中的所有转义字符是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆