Class

grizzled.string.Implicits.String

GrizzledString

Related Doc: package String

Permalink

implicit class GrizzledString extends AnyRef

An analog to Scala's RichString class, providing some methods that neither RichString nor String provide. By importing the implicit conversion functions, you can use the methods in this class transparently from a String or RichString object.

Examples

These examples assume you've included this import:

import grizzled.string.Implicits.String._

These are just a few of the enrichments available. See below for the entire set.

val s = "a  b          c"
println(s.tokenize) // prints: List(a, b, c)
"    abc   def      ".rtrim // yields "    abc   def"
"© 2016 The Example Company"  // yields "© 2016 The Example Company™
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. GrizzledString
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new GrizzledString(string: String)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def chomp: String

    Permalink

    Like perl's chomp(): Remove any newline at the end of the line.

    Like perl's chomp(): Remove any newline at the end of the line.

    returns

    the possibly modified line

  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  9. def escapeNonPrintables: String

    Permalink

    Escape any non-printable characters by converting them to metacharacter sequences.

    Escape any non-printable characters by converting them to metacharacter sequences.

    returns

    the possibly translated string

  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  14. def ltrim: String

    Permalink

    Trim white space from the front (left) of a string.

    Trim white space from the front (left) of a string.

    returns

    possibly modified string

  15. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. def rtrim: String

    Permalink

    Trim white space from the back (right) of a string.

    Trim white space from the back (right) of a string.

    returns

    possibly modified string

  19. val string: String

    Permalink
  20. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  21. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  22. def toTokens: List[StringToken]

    Permalink

    Tokenize the string on white space, returning Token objects.

    Tokenize the string on white space, returning Token objects. This method is useful when you need to keep track of the locations of the tokens within the original string.

    returns

    A list of tokens, or Nil if there aren't any.

  23. def toTokens(delims: String): List[StringToken]

    Permalink

    Tokenize the string on a set of delimiter characters, returning Token objects.

    Tokenize the string on a set of delimiter characters, returning Token objects. This method is useful when you need to keep track of the locations of the tokens within the original string.

    delims

    the delimiter characters

    returns

    A list of tokens, or Nil if there aren't any.

  24. def tokenize(delims: String): List[String]

    Permalink

    Tokenize the string on a set of delimiter characters.

    Tokenize the string on a set of delimiter characters.

    delims

    the delimiter characters

    returns

    A list of tokens, or Nil if there aren't any.

  25. def tokenize: List[String]

    Permalink

    Tokenize the string on white space.

    Tokenize the string on white space. An empty string and a string with only white space are treated the same. Note that doing a split("""\s+""").toList on an empty string ("") yields a list of one item, an empty string. Doing the same operation on a blank string (" ", for example) yields an empty list. This method differs from split("""\s+""").toList, in that both cases are treated the same, returning a Nil.

    returns

    A list of tokens, or Nil if there aren't any.

  26. def translateMetachars: String

    Permalink

    Translate any metacharacters (e.g,.

    Translate any metacharacters (e.g,. \t, \n, \\u2122) into their real characters, and return the translated string. Metacharacter sequences that cannot be parsed (because they're unrecognized, because the Unicode number isn't four digits, etc.) are passed along unchanged.

    returns

    the possibly translated string

  27. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped