Scala string interpolation with escaped quote fails

后端 未结 1 1764
青春惊慌失措
青春惊慌失措 2020-12-20 17:32
scala> util.Properties.versionString
res11: String = version 2.11.2

scala> val a = \"\"
a: String = \"\"

scala> val a = \"\\\"\"
a: String = \"

相关标签:
1条回答
  • 2020-12-20 17:56

    This appears to be a known bug.

    Note that you can get around it, at least for your case above, using triple quotes:

    scala> val a = s"""""""" // seven quote characters all up!
    a: String = "
    
    0 讨论(0)
提交回复
热议问题