更新时间:2023-12-06 12:15:58
Scala 不支持字符串插值.有一个编译器插件可以在 http://github.com/jrudolph/scala-enhanced-字符串.
Scala does not support string interpolation. There is a compiler plugin that implements it at http://github.com/jrudolph/scala-enhanced-strings.
如果没有插件,您可以使用连接或格式字符串:
Without the plugin you can use concatenation or format strings:
val str = name formatted "Hi, %s!"
或者当然
val str = "Hi, %s!".format(name)