Packages

  • package root
    Definition Classes
    root
  • package grizzled

    The Grizzled Scala Library contains a variety of miscellaneous, general purpose utility classes and objects.

    The Grizzled Scala Library contains a variety of miscellaneous, general purpose utility classes and objects.

    The home page for the Grizzled Scala Library is http://software.clapper.org/grizzled-scala/. Please see that page for complete details, including installation instructions.

    Definition Classes
    root
  • package string

    String- and text-related classes.

    String- and text-related classes.

    Definition Classes
    grizzled
  • object Implicits

    String and character implicits.

    String and character implicits.

    Definition Classes
    string
  • object String

    String enrichment classes.

    String enrichment classes.

    Definition Classes
    Implicits
  • GrizzledString

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)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def chomp: String

    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
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. def escapeNonPrintables: String

    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
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. def ltrim: String

    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
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. def replaceFirstChar(c: Char, replacement: String): String

    Replace the first instance of the specified character with string, returning the new string.

    Replace the first instance of the specified character with string, returning the new string. This method differs from the JDK's replaceFirst() method in that it takes a target character, not a regular expression. It's ideal when you don't want to worry about escaping a regular expression metacharacter.

    c

    the character to find

    replacement

    the replacement string

    returns

    the (possibly changed) new string

  19. def replaceFirstChar(c: Char, replacement: Char): String

    Replace the first instance of the specified character with another character, returning the new string.

    Replace the first instance of the specified character with another character, returning the new string. This method differs from the JDK's replaceFirst() method in that it takes a target character, not a regular expression. It's ideal when you don't want to worry about escaping a regular expression metacharacter.

    c

    the character to find

    replacement

    the replacement character

    returns

    the (possibly changed) new string

  20. def rtrim: String

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

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

    returns

    possibly modified string

  21. val string: String
  22. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  23. def toString(): String
    Definition Classes
    AnyRef → Any
  24. def toTokens: List[StringToken]

    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.

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

    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.

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

    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.

  27. def tokenize: List[String]

    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.

  28. def translateMetachars: String

    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

  29. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped