WithFilter

scala.collection.StringOps.WithFilter
class WithFilter(p: Char => Boolean, s: String)

A lazy filtered string. No filtering is applied until one of foreach, map or flatMap is called.

Value parameters

p

the predicate used to filter characters

s

the underlying string to filter

Attributes

Source
StringOps.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def flatMap[B](f: Char => IterableOnce[B]^): IndexedSeq[B]

Builds a new collection by applying a function to all chars of this filtered string and using the elements of the resulting collections.

Builds a new collection by applying a function to all chars of this filtered string and using the elements of the resulting collections.

Type parameters

B

the element type of the returned collection

Value parameters

f

the function to apply to each char.

Attributes

Returns

a new collection resulting from applying the given collection-valued function f to each char of this string and concatenating the results.

Source
StringOps.scala
def flatMap(f: Char => String): String

Builds a new string by applying a function to all chars of this filtered string and using the elements of the resulting Strings.

Builds a new string by applying a function to all chars of this filtered string and using the elements of the resulting Strings.

Value parameters

f

the function to apply to each char.

Attributes

Returns

a new string resulting from applying the given string-valued function f to each char of this string and concatenating the results.

Source
StringOps.scala
def foreach[U](f: Char => U): Unit

Applies f to each element for its side effects. Note: [U] parameter needed to help scalac's type inference.

Applies f to each element for its side effects. Note: [U] parameter needed to help scalac's type inference.

Type parameters

U

the return type of the function f, used only for side effects

Value parameters

f

the function to apply to each char

Attributes

Source
StringOps.scala
def map[B](f: Char => B): IndexedSeq[B]

Builds a new collection by applying a function to all chars of this filtered string.

Builds a new collection by applying a function to all chars of this filtered string.

Type parameters

B

the element type of the returned collection

Value parameters

f

the function to apply to each char.

Attributes

Returns

a new collection resulting from applying the given function f to each char of this string and collecting the results.

Source
StringOps.scala
def map(f: Char => Char): String

Builds a new string by applying a function to all chars of this filtered string.

Builds a new string by applying a function to all chars of this filtered string.

Value parameters

f

the function to apply to each char.

Attributes

Returns

a new string resulting from applying the given function f to each char of this string and collecting the results.

Source
StringOps.scala
def withFilter(q: Char => Boolean): WithFilter^{this, q}

Creates a new non-strict filter which combines this filter with the given predicate.

Creates a new non-strict filter which combines this filter with the given predicate.

Value parameters

q

the additional predicate to apply to each char

Attributes

Source
StringOps.scala