scala.collection.immutable

trait StringLike

[source: scala/collection/immutable/StringLike.scala]

trait StringLike[+Repr]
extends IndexedSeqLike[Char, Repr] with Ordered[java.lang.String]
Since
2.8
Direct Known Subclasses:
StringOps, WrappedString

Method Summary
def * (n : Int) : java.lang.String
return n times the current string
def apply (n : Int) : Char
Return element at index `n`
def capitalize : java.lang.String
Returns this string with first character converted to upper case
override def compare (other : java.lang.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 format (l : java.util.Locale, args : Any*) : java.lang.String
def format (args : Any*) : java.lang.String
def length : Int
Returns the length of the sequence.
def lines : Iterator[java.lang.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 linesIterator : Iterator[java.lang.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[java.lang.String]
override def mkString : java.lang.String
Returns a string representation of this traversable object. The string representations of elements (w.r.t. the method toString()) follow each other without any separator string.
protected[this] abstract def newBuilder : Builder[Char, Repr]
Creates a string builder buffer as builder for this class
def r : Regex
You can follow a string with `.r', turning it into a Regex. E.g. """A\w*""".r is the regular expression for identifiers starting with `A'.
def split (separator : Char) : Array[java.lang.String]
def split (separators : Array[Char]) : Array[java.lang.String]
def stripLineEnd : java.lang.String
def stripMargin (marginChar : Char) : java.lang.String
def stripMargin : java.lang.String
def stripPrefix (prefix : java.lang.String) : java.lang.String
Returns this string with the given prefix stripped.
def stripSuffix (suffix : java.lang.String) : java.lang.String
Returns this string with the given suffix stripped.
def toBoolean : Boolean
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 IndexedSeqLike
thisCollection, toCollection, iterator, isEmpty, foreach, forall, exists, find, foldLeft, foldRight, reduceLeft, reduceRight, zip, zipWithIndex, slice, head, tail, last, init, take, drop, takeRight, dropRight, splitAt, takeWhile, dropWhile, span, sameElements, copyToArray, lengthCompare, segmentLength, indexWhere, lastIndexWhere, reverse, reverseIterator, startsWith, endsWith, view, view
Methods inherited from SeqLike
size, isDefinedAt, prefixLength, indexWhere, findIndexOf, indexOf, indexOf, lastIndexOf, lastIndexOf, lastIndexWhere, reverseMap, reversedElements, startsWith, indexOfSeq, indexOfSeq, lastIndexOfSeq, lastIndexOfSeq, contains, union, diff, intersect, removeDuplicates, patch, updated, +:, :+, padTo, sortWith, sortWith, sortBy, toSeq, indices, hashCode, equals, toString, findLastIndexOf, equalsWith, containsSlice, projection
Methods inherited from IterableLike
elements, toIterable, zipAll, toStream, canEqual, first, firstOption
Methods inherited from TraversableLike
repr, nonEmpty, hasDefiniteSize, ++, ++, map, flatMap, filter, filterNot, partialMap, remove, partition, groupBy, count, /:, :\, reduceLeftOption, reduceRightOption, sum, product, min, max, headOption, lastOption, copyToBuffer, copyToArray, toArray, toList, toIndexedSeq, toSet, mkString, mkString, addString, addString, addString, stringPrefix, withFilter
Methods inherited from AnyRef
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
protected[this] abstract def newBuilder : Builder[Char, Repr]
Creates a string builder buffer as builder for this class

def apply(n : Int) : Char
Return element at index `n`
Throws
IndexOutofBoundsException - if the index is not valid

def length : Int
Returns the length of the sequence.

override def mkString : java.lang.String
Returns a string representation of this traversable object. The string representations of elements (w.r.t. the method toString()) follow each other without any separator string.

def *(n : Int) : java.lang.String
return n times the current string

override def compare(other : java.lang.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 stripLineEnd : java.lang.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[java.lang.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[java.lang.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 linesIterator : Iterator[java.lang.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 : java.lang.String
Returns this string with first character converted to upper case

def stripPrefix(prefix : java.lang.String) : java.lang.String
Returns this string with the given prefix stripped.

def stripSuffix(suffix : java.lang.String) : java.lang.String
Returns this string with the given suffix stripped.

def stripMargin(marginChar : Char) : java.lang.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 : java.lang.String

For every line in this string:

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

@throws(classOf[java.util.regex.PatternSyntaxException])

def split(separator : Char) : Array[java.lang.String]

@throws(classOf[java.util.regex.PatternSyntaxException])

def split(separators : Array[Char]) : Array[java.lang.String]

def r : Regex
You can follow a string with `.r', turning it into a Regex. E.g. """A\w*""".r is the regular expression for identifiers starting with `A'.

def toBoolean : Boolean

def toByte : Byte

def toShort : Short

def toInt : Int

def toLong : Long

def toFloat : Float

def toDouble : Double

def format(args : Any*) : java.lang.String

Uses the underlying string as a pattern (in a fashion similar to printf in C), and uses the supplied arguments to fill in the holes.

The interpretation of the formatting patterns is described in java.util.Formatter.

Parameters
args - the arguments used to instantiating the pattern.
Throws
java.lang.IllegalArgumentException -

def format(l : java.util.Locale, args : Any*) : java.lang.String

Like format(args*) but takes an initial Locale parameter which influences formatting as in java.lang.String's format.

The interpretation of the formatting patterns is described in java.util.Formatter.

Parameters
locale - an instance of java.util.Locale
args - the arguments used to instantiating the pattern.
Throws
java.lang.IllegalArgumentException -