We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8ecb139 commit 6d14566Copy full SHA for 6d14566
source/_posts/Java14新特性:字符串块.md
@@ -0,0 +1,38 @@
1
+title: Java14新特性:字符串块
2
+tags:
3
+ - java14
4
+categories:
5
+ - Dev
6
+ - Java
7
+date: 2020-03-20 14:04:00
8
+cover: true
9
+
10
+---
11
12
+
13
+<!-- more -->
14
+java1之前写字符串拼接
15
+```
16
+ String str = "<html>" +
17
+ "<header>" +
18
+ "</header>" +
19
+ "<body>" +
20
+ "<div>body</div>" +
21
+ "</body>" +
22
+ "</html>";
23
24
+内容短的时候还算可以,当需要拼接的内容很多的时候就会显得很乱
25
26
+java14后,引进了三个引号作为字符串块,类似python中的字符串块
27
28
+ // 注意 """ 之后必须换行
29
+ String str = """
30
+ <html>
31
+ <header>
32
+ </header>
33
+ <body>
34
+ <div>"body"</div>
35
+ </body>
36
+ </html>
37
+ """;
38
0 commit comments