0__*_*0__ 11 scala string-interpolation
"""使用字符串插值和换行符时,我得到三重引号字符串的结果:
val foo = "bar"
s"""$foo"""
Run Code Online (Sandbox Code Playgroud)
还行吧.
s"""
$foo
"""
Run Code Online (Sandbox Code Playgroud)
这是错误的,我得到以下输出:
"
bar
"
Run Code Online (Sandbox Code Playgroud)
为什么有引号?
Imp*_*ive 18
这只是引号中包含多行字符串的REPL.你会发现实际的字符串不包含引号:
res0.contains("\"")
res1 : Boolean = false
Run Code Online (Sandbox Code Playgroud)