您的位置:首页 > 编程语言 > Java开发

Java String 里面输入跳脱 字符 \

2016-06-20 11:13 627 查看
摘要: How to enter quotes in a Java string?

In Java, 可以用
\ 符号来跳脱双引号
:

\ 跟在需要跳脱符号的前面。

String value = " \"ROM\" ";

Linux 里面的 这个符号 \ 也是跳脱特殊符号的意思。

[dmtsai@study ~]$ grep -n '\.$' regular_express.txt
1:"Open Source" is a good mechanism to develop programs.
2:apple is my favorite food.
3:Football game is not use feet only.
4:this dress doesn't fit me.
10:motorcycle is cheap than car.
11:This window is clear.
12:the symbol '*' is represented as start.
15:You are the best is mean you are the no. 1.
16:The world <Happy> is the same with "glad".
17:I like dog.
18:google is the best tools for search keyword.
20:go! go! Let's go.

特別注意到,因為小數點具有其他意義(底下會介紹),所以必須要使用跳脫字元(\)來加以解除其特殊意義!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息