diff options
Diffstat (limited to 'src/library/scalax')
-rwxr-xr-x | src/library/scalax/collection/mutable/StringBuilder.scala | 25 | ||||
-rw-r--r-- | src/library/scalax/runtime/BoxedString.scala | 6 |
2 files changed, 5 insertions, 26 deletions
diff --git a/src/library/scalax/collection/mutable/StringBuilder.scala b/src/library/scalax/collection/mutable/StringBuilder.scala index 30aeba4aed..386f316f27 100755 --- a/src/library/scalax/collection/mutable/StringBuilder.scala +++ b/src/library/scalax/collection/mutable/StringBuilder.scala @@ -816,8 +816,8 @@ final class StringBuilder(initCapacity: Int, private val initValue: String) val temp2 = array(n - j) if (!hasSurrogate) hasSurrogate = - (temp >= StringBuilder.MIN_SURROGATE && temp <= StringBuilder.MAX_SURROGATE) || - (temp2 >= StringBuilder.MIN_SURROGATE && temp2 <= StringBuilder.MAX_SURROGATE) + (temp >= Character.MIN_HIGH_SURROGATE && temp <= Character.MAX_LOW_SURROGATE) || + (temp2 >= Character.MIN_HIGH_SURROGATE && temp2 <= Character.MAX_LOW_SURROGATE) array(j) = temp2 array(n - j) = temp j -= 1 @@ -827,9 +827,9 @@ final class StringBuilder(initCapacity: Int, private val initValue: String) var i = 0 while (i < count - 1) { val c2 = array(i) - if (StringBuilder.isLowSurrogate(c2)) { + if (Character.isLowSurrogate(c2)) { val c1 = array(i + 1) - if (StringBuilder.isHighSurrogate(c1)) { + if (Character.isHighSurrogate(c1)) { array(i) = c1; i += 1 array(i) = c2 } @@ -857,23 +857,6 @@ object StringBuilder { type Array[T] = scala.Array[T] // !!! - private val MIN_HIGH_SURROGATE = '\uD800' - private val MAX_HIGH_SURROGATE = '\uDBFF' - - private val MIN_LOW_SURROGATE = '\uDC00' - private val MAX_LOW_SURROGATE = '\uDFFF' - - // constants <code>java.langCharacter.MIN-/MAX_SURROGATE</code> exist since 1.5 - private val MIN_SURROGATE = MIN_HIGH_SURROGATE - private val MAX_SURROGATE = MAX_LOW_SURROGATE - - // methods <code>java.langCharacter.isLow-/isHighSurrogate</code> exist since 1.5 - private def isLowSurrogate(ch: Char): Boolean = - MIN_LOW_SURROGATE <= ch && ch <= MAX_LOW_SURROGATE - - private def isHighSurrogate(ch: Char): Boolean = - MIN_HIGH_SURROGATE <= ch && ch <= MAX_HIGH_SURROGATE - // method <code>java.util.Arrays.copyOf</code> exists since 1.6 private def copyOf(src: Array[Char], newLength: Int): Array[Char] = { val dest = new Array[Char](newLength) diff --git a/src/library/scalax/runtime/BoxedString.scala b/src/library/scalax/runtime/BoxedString.scala index 67ba804576..ef5a8b43c7 100644 --- a/src/library/scalax/runtime/BoxedString.scala +++ b/src/library/scalax/runtime/BoxedString.scala @@ -151,11 +151,7 @@ class BoxedString(val self: String) extends StringVector[Char] with Proxy with P */ def stripMargin: String = stripMargin('|') - // 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" - } + private def escape(ch: Char): String = "\\Q" + ch + "\\E" @throws(classOf[java.util.regex.PatternSyntaxException]) def split(separator: Char): Array[String] = self.split(escape(separator)) |