Вопрос

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
Это было полезно?

Решение

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
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top