Scala raw strings error in unicode escape

回眸只為那壹抹淺笑 提交于 2019-11-29 14:18:27

You appear to be facing issue SI-4706: Unicode literal syntax thwarts common use cases for triple-quotes.

In Scala, unicode escape sequences are processed not only inside character or string literals. It may not be obvious that the following code would work:

scala> 5 \u002B 10
res0: Int = 15

Unfortunately, there doesn't seem to be a good way around this if you don't want to disable unicode escapes completely (-Xno-uescape). One of workarounds suggested in the issue is separating the backslash character:

scala> """\""" + """usepackage{X}"""
res1: String = \usepackage{X}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!