scala.runtime

class RichString

[source: scala/runtime/RichString.scala]

final class RichString(val self : String)
extends Proxy with Seq[Char] with Ordered[String]
Method Summary
def apply (n : Int) : Char
Retrieve the n-th character of the string
def capitalize : String
Returns this string with first character converted to upper case
def compare (other : String) : Int
Result of comparing this with operand that. returns x where x < 0 iff this < that x == 0 iff this == that x > 0 iff this > that
def elements : Iterator[Char]
Creates a new iterator over all elements contained in this object.
def length : Int
Returns the length of the sequence.
def lines : Iterator[String]
Return all lines in this string in an iterator, excluding trailing line end characters, i.e. apply .stripLineEnd to all lines returned by linesWithSeparators.
def linesWithSeparators : Iterator[String]

Return all lines in this string in an iterator, including trailing line end characters.

The number of strings returned is one greater than the number of line end characters in this string. For an empty string, a single empty line is returned. A line end character is one of

  • LF - line feed (0x0A hex)
  • FF - form feed (0x0C hex)
def split (separator : Char) : Array[String]
def stripLineEnd : String

Strip trailing line end character from this string if it has one. A line end character is one of

  • LF - line feed (0x0A hex)
  • FF - form feed (0x0C hex)

If a line feed character LF is preceded by a carriage return CR (0x0D hex), the CR character is also stripped (Windows convention).

def stripMargin : String

For every line in this string:

Strip a leading prefix consisting of blanks or control characters followed by | from the line.
def stripMargin (marginChar : Char) : String

For every line in this string:

Strip a leading prefix consisting of blanks or control characters followed by marginChar from the line.
def toByte : Byte
def toDouble : Double
def toFloat : Float
def toInt : Int
def toLong : Long
def toShort : Short
Methods inherited from Ordered
<, >, <=, >=, compareTo
Methods inherited from Seq
size, isEmpty, concat, ++, isDefinedAt, lastIndexOf, map, flatMap, filter, take, drop, takeWhile, dropWhile, reverse, contains, slice, subseq, toArray
Methods inherited from Collection
toString, stringPrefix
Methods inherited from Iterable
foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, mkString, mkString, addString, addString, copyToArray, projection, hasDefiniteSize
Methods inherited from PartialFunction
orElse, andThen
Methods inherited from Function1
compose
Methods inherited from Proxy
hashCode, equals
Methods inherited from AnyRef
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
def compare(other : String) : Int
Result of comparing this with operand that. returns x where x < 0 iff this < that x == 0 iff this == that x > 0 iff this > that
Overrides
Ordered.compare

def length : Int
Returns the length of the sequence.
Returns
the sequence length.
Overrides
Seq.length

def elements : Iterator[Char]
Creates a new iterator over all elements contained in this object.
Returns
the new iterator

def apply(n : Int) : Char
Retrieve the n-th character of the string
Parameters
index - into the string
Returns
the character at position index.

def stripLineEnd : String

Strip trailing line end character from this string if it has one. A line end character is one of

  • LF - line feed (0x0A hex)
  • FF - form feed (0x0C hex)

If a line feed character LF is preceded by a carriage return CR (0x0D hex), the CR character is also stripped (Windows convention).


def linesWithSeparators : Iterator[String]

Return all lines in this string in an iterator, including trailing line end characters.

The number of strings returned is one greater than the number of line end characters in this string. For an empty string, a single empty line is returned. A line end character is one of

  • LF - line feed (0x0A hex)
  • FF - form feed (0x0C hex)

def lines : Iterator[String]
Return all lines in this string in an iterator, excluding trailing line end characters, i.e. apply .stripLineEnd to all lines returned by linesWithSeparators.

def capitalize : String
Returns this string with first character converted to upper case

def stripMargin(marginChar : Char) : String

For every line in this string:

Strip a leading prefix consisting of blanks or control characters followed by marginChar from the line.

def stripMargin : String

For every line in this string:

Strip a leading prefix consisting of blanks or control characters followed by | from the line.

def split(separator : Char) : Array[String]

def toByte : Byte

def toShort : Short

def toInt : Int

def toLong : Long

def toFloat : Float

def toDouble : Double