2013-06-27 34 views
1

前綴raw可用於告知編譯器不要轉義字符串中的任何字符。但是當我嘗試這樣做時,爲什麼會出現編譯錯誤?斯卡拉字符串插值。正則表達式中的`raw`前綴

raw"\d".r // not escaped slash 
+0

我沒有得到2.10.2 –

+1

串插任何編譯錯誤在斯卡拉2.10 http://docs.scala-lang.org/overviews/core/string介紹-interpolation.html – JasonG

回答

1

您使用的是什麼版本的Scala?在2.10.0正常工作:

Welcome to Scala version 2.10.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_37). 
Type in expressions to have them evaluated. 
Type :help for more information. 

scala> raw"\d".r 
res0: scala.util.matching.Regex = \d 
相關問題