src/Pure/library.scala
changeset 80441 c420429fdf4c
parent 80440 dfadcfdf8dad
child 80478 902e6da44a68
equal deleted inserted replaced
80440:dfadcfdf8dad 80441:c420429fdf4c
   192 
   192 
   193     def subSequence(i: Int, j: Int): CharSequence =
   193     def subSequence(i: Int, j: Int): CharSequence =
   194       if (0 <= i && i <= j && j <= length) new Reverse(text, end - j, end - i)
   194       if (0 <= i && i <= j && j <= length) new Reverse(text, end - j, end - i)
   195       else throw new IndexOutOfBoundsException
   195       else throw new IndexOutOfBoundsException
   196 
   196 
   197     override def toString: String = {
   197     override def toString: String =
   198       val buf = new StringBuilder(length)
   198       string_builder(hint = length) { buf => for (i <- 0 until length) buf.append(charAt(i)) }
   199       for (i <- 0 until length)
       
   200         buf.append(charAt(i))
       
   201       buf.toString
       
   202     }
       
   203   }
   199   }
   204 
   200 
   205   class Line_Termination(text: CharSequence) extends CharSequence {
   201   class Line_Termination(text: CharSequence) extends CharSequence {
   206     def length: Int = text.length + 1
   202     def length: Int = text.length + 1
   207     def charAt(i: Int): Char = if (i == text.length) '\n' else text.charAt(i)
   203     def charAt(i: Int): Char = if (i == text.length) '\n' else text.charAt(i)