diff options
author | michelou <michelou@epfl.ch> | 2008-01-30 16:11:00 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2008-01-30 16:11:00 +0000 |
commit | 817317824a1c62eabd9e09b7d2e98494292d8695 (patch) | |
tree | 32948c775ffebed636315286074a057a9d35882f | |
parent | 1dda54121ee66cb5251cfa3145e167529a9301de (diff) | |
download | scala-817317824a1c62eabd9e09b7d2e98494292d8695.tar.gz scala-817317824a1c62eabd9e09b7d2e98494292d8695.tar.bz2 scala-817317824a1c62eabd9e09b7d2e98494292d8695.zip |
forget to ci test file (regexp pattern)
-rw-r--r-- | test/files/run/bug0325.scala | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test/files/run/bug0325.scala b/test/files/run/bug0325.scala index dc05a8d777..236f1b101f 100644 --- a/test/files/run/bug0325.scala +++ b/test/files/run/bug0325.scala @@ -1,8 +1,15 @@ case class RS(self: String) { - def split(separator: Char): Array[String] = self.split("\\Q"+separator+"\\E") + + // NB. "\\Q" + '\\' + "\\E" works on Java 1.5 and newer, but not on Java 1.4 + private def escape(ch: Char): String = ch match { + case '\\' => "\\\\" + case _ => "\\Q"+ch+"\\E" + } + + def split(separator: Char): Array[String] = self.split(escape(separator)) def split(separators: Array[Char]): Array[String] = { - val re = separators.foldLeft("[")(_+"\\Q"+_+"\\E") + "]" + val re = separators.foldLeft("[")(_+escape(_)) + "]" self.split(re) } } |