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.
the possibly modified line
Escape any non-printable characters by converting them to metacharacter sequences.
Escape any non-printable characters by converting them to metacharacter sequences.
the possibly translated string
Trim white space from the front (left) of a string.
Trim white space from the front (left) of a string.
possibly modified string
Trim white space from the back (right) of a string.
Trim white space from the back (right) of a string.
possibly modified string
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.
A list of tokens, or Nil
if there aren't any.
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.
the delimiter characters
A list of tokens, or Nil
if there aren't any.
Tokenize the string on a set of delimiter characters.
Tokenize the string on a set of delimiter characters.
the delimiter characters
A list of tokens, or Nil
if there aren't any.
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
.
A list of tokens, or Nil
if there aren't any.
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.
the possibly translated string
An analog to Scala's
RichString
class, providing some methods that neitherRichString
norString
provide. By importing the implicit conversion functions, you can use the methods in this class transparently from aString
orRichString
object.Examples
These examples assume you've included this import:
These are just a few of the enrichments available. See below for the entire set.