最佳答案
在转义函数中的所有引号时遇到麻烦
(it 的基本用法-> if i find a string do nothing,if it not a string add)
代码片段:
def putTheDoubleQuotes(value: Any): Any = {
value match {
case s: String => s //do something ...
case _ => s"\"$value\"" //not working
}
}
唯一奏效的就是:
Case _ = > s“”“ $value”“”
有更好的语法吗?
它看起来很糟糕,IDE (IntelliJ)将它标记为红色(但是让你运行它,这真的让我很恼火!)