Domanda

The raw prefix can be used to tell to the compiler not to escape any characters in string. But why I get compilation error when I try to do like this?

raw"\d".r  // not escaped slash
È stato utile?

Soluzione

What version of Scala are you using? Works fine in 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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top