在string插值中转义美元符号

如何在string插值中转义美元符号?

def getCompanion(name: String) = Class.forName(s"my.package.$name\$") // --> "error: unclosed string literal" 

把它加倍

 scala> val name = "foo" name: String = foo scala> s"my.package.$name$$" res0: String = my.package.foo$