Package: java.lang

## [Java] Interface CharSequence

-     public interface CharSequence

  GDK enhancements for CharSequence.

  displayName:
    CharSequence
  receiverFqcn:
    java.lang.CharSequence

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public boolean` | `asBoolean()` Coerces a CharSequence to a boolean value.
    `<T>` | `public T` | `asType(Class<T> c)` Provides a method to perform custom 'dynamic' type conversion to the given class using the `as` operator.
    `` | `public Pattern` | `bitwiseNegate()` Turns a CharSequence into a regular expression Pattern.
    `` | `public String` | `capitalize()` Convenience method to capitalize the first letter of a CharSequence (typically the first letter of a word).
    `` | `public String` | `center(Number numberOfChars)` Pads a CharSequence to a minimum length specified by `numberOfChars` by adding the space character around it as many times as needed so that it remains centered.
    `` | `public String` | `center(Number numberOfChars, CharSequence padding)` Pad a CharSequence to a minimum length specified by `numberOfChars`, appending the supplied padding CharSequence around the original as many times as needed keeping it centered.
    `` | `public boolean` | `contains(CharSequence text)` Provides an implementation of contains() like Collection.contains to make CharSequences more polymorphic.
    `` | `public boolean` | `containsIgnoreCase(CharSequence searchString)` Checks whether this CharSequence contains the `searchString` ignoring the caseConsiderations.
    `` | `public int` | `count(CharSequence text)` Counts the number of occurrences of a sub CharSequence.
    `` | `public String` | `denormalize()` Return a CharSequence with lines (separated by LF, CR/LF, or CR) terminated by the platform specific line separator.
    `` | `public String` | `digest(String algorithm)` digest the CharSequence instance
    `` | `public CharSequence` | `drop(int num)` Drops the given number of chars from the head of this CharSequence if they are available.
    `` | `public CharSequence` | `dropRight(int num)` Returns new CharSequence after removing the right `num` chars.
    `` | `public String` | `dropWhile(Closure condition)` Creates a suffix of the given CharSequence by dropping as many characters as possible from the front of the original CharSequence such that calling the given closure condition evaluates to true when passed each of the dropped characters.
    `<T>` | `public T` | `eachLine(Closure<T> closure)` Iterates through this CharSequence line by line.
    `<T>` | `public T` | `eachLine(int firstLine, Closure<T> closure)` Iterates through this CharSequence line by line.
    `` | `public boolean` | `endsWithAny(CharSequence suffixes)` Tests if this CharSequence ends with any specified suffixes.
    `` | `public boolean` | `endsWithIgnoreCase(CharSequence searchString)` Checks whether this CharSequence ends with the `searchString` ignoring the case considerations.
    `` | `public String` | `expand()` Expands all tabs into spaces with tabStops of size 8.
    `` | `public String` | `expand(int tabStop)` Expands all tabs into spaces.
    `` | `public String` | `expandLine(int tabStop)` Expands all tabs into spaces.
    `` | `public String` | `find(CharSequence regex)` Finds the first occurrence of a regular expression String within a String.
    `` | `public String` | `find(CharSequence regex, Closure closure)` Returns the result of calling a closure with the first occurrence of a regular expression found within a CharSequence.
    `` | `public String` | `find(Pattern pattern)` Finds the first occurrence of a compiled regular expression Pattern within a String.
    `` | `public String` | `find(Pattern pattern, Closure closure)` Returns the result of calling a closure with the first occurrence of a compiled regular expression found within a String.
    `` | `public List<String>` | `findAll(CharSequence regex)` Returns a (possibly empty) list of all occurrences of a regular expression (provided as a CharSequence) found within a CharSequence.
    `<T>` | `public List<T>` | `findAll(CharSequence regex, Closure<T> closure)` Finds all occurrences of a regular expression string within a CharSequence.
    `` | `public List<String>` | `findAll(Pattern pattern)` Returns a (possibly empty) list of all occurrences of a regular expression (in Pattern format) found within a CharSequence.
    `<T>` | `public List<T>` | `findAll(Pattern pattern, Closure<T> closure)` Finds all occurrences of a compiled regular expression Pattern within a CharSequence.
    `` | `public List<List<String>>` | `findAllGroups(CharSequence regex)` Returns a (possibly empty) list of all occurrences of a regular expression within a CharSequence, with each occurrence represented by a List containing the full match followed by each capture group.
    `` | `public List<List<String>>` | `findAllGroups(Pattern pattern)` Returns a (possibly empty) list of all occurrences of a compiled regular expression Pattern within a CharSequence, with each occurrence represented by a List containing the full match followed by each capture group.
    `` | `public List<BalancedGroup>` | `findBalancedGroups(String openRegex, String closeRegex)` Finds balanced (nested) groups in this CharSequence using default options (no ignore pattern; opening and closing delimiters are kept in the match text).
    `` | `public List<BalancedGroup>` | `findBalancedGroups(String openRegex, String closeRegex, MatchOptions options)` Finds balanced (nested) groups in this CharSequence with the given options.
    `` | `public List<String>` | `findGroups(CharSequence regex)` Finds the first occurrence of a regular expression within a CharSequence and returns the full match followed by each capture group as a List.
    `` | `public List<String>` | `findGroups(Pattern pattern)` Finds the first occurrence of a compiled regular expression Pattern within a CharSequence and returns the full match followed by each capture group as a List.
    `` | `public String` | `getAt(Collection indices)` Selects a List of characters from a CharSequence using a Collection to identify the indices to be selected.
    `` | `public String` | `getAt(EmptyRange range)` Supports the range subscript operator for CharSequence or StringBuffer with EmptyRange
    `` | `public CharSequence` | `getAt(int index)` Supports the subscript operator for CharSequence.
    `` | `public CharSequence` | `getAt(IntRange range)` Supports the range subscript operator for CharSequence with IntRange.
    `` | `public CharSequence` | `getAt(Range range)` Supports the range subscript operator for CharSequence.
    `` | `public char[]` | `getChars()` Converts the given CharSequence into an array of characters.
    `` | `public int[]` | `getCodePoints()` Converts the given CharSequence into an array of code point values including any surrogate pairs as per String.codePoints.
    `` | `public boolean` | `isAllWhitespace()` Returns true if a CharSequence only contains whitespace characters.
    `` | `public boolean` | `isBigDecimal()` Determines if a CharSequence can be parsed as a BigDecimal.
    `` | `public boolean` | `isBigInteger()` Determines if a CharSequence can be parsed as a BigInteger.
    `` | `public boolean` | `isBlank()` Tests if this CharSequence is blank.
    `` | `public boolean` | `isCase(Object switchValue)` 'Case' implementation for a CharSequence, which uses equals between the toString() of the caseValue and the switchValue.
    `` | `public boolean` | `isDouble()` Determines if a CharSequence can be parsed as a Double.
    `` | `public boolean` | `isFloat()` Determines if a CharSequence can be parsed as a Float.
    `` | `public boolean` | `isInteger()` Determines if a CharSequence can be parsed as an Integer.
    `` | `public boolean` | `isLong()` Determines if a CharSequence can be parsed as a Long.
    `` | `public boolean` | `isNotCase(Object switchValue)` Since: 4.0.0
    `` | `public boolean` | `isNumber()` Determines if a CharSequence can be parsed as a Number.
    `` | `public StringBuilder` | `leftShift(Object value)` Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a CharSequence.
    `` | `public boolean` | `matches(Pattern pattern)` Determines if a CharSequence matches the given regular expression.
    `` | `public String` | `md5()` Calculate md5 of the CharSequence instance
    `` | `public String` | `minus(Object target)` Removes a part of a CharSequence by replacing the first occurrence of target within self with empty string and returns the result.
    `` | `public String` | `minus(Pattern pattern)` Removes a part of a CharSequence.
    `` | `public String` | `multiply(Number factor)` Repeats a CharSequence a certain number of times.
    `` | `public String` | `next()` Overloads the `++` operator for the class CharSequence.
    `` | `public String` | `next(int n)` A variant of next with an integer count parameter; equivalent to calling next() count times.
    `` | `public String` | `normalize()` Returns a String with linefeeds and carriage returns normalized to linefeeds.
    `` | `public String` | `padLeft(Number numberOfChars)` Pads a CharSequence to a minimum length specified by `numberOfChars` by adding the space character to the left as many times as needed.
    `` | `public String` | `padLeft(Number numberOfChars, CharSequence padding)` Pads a CharSequence to a minimum length specified by `numberOfChars`, adding the supplied padding CharSequence as many times as needed to the left.
    `` | `public String` | `padRight(Number numberOfChars)` Pads a CharSequence to a minimum length specified by `numberOfChars` by adding the space character to the right as many times as needed.
    `` | `public String` | `padRight(Number numberOfChars, CharSequence padding)` Pads a CharSequence to a minimum length specified by `numberOfChars`, adding the supplied padding CharSequence as many times as needed to the right.
    `` | `public String` | `plus(Object right)` Appends the String representation of the given operand to this CharSequence.
    `` | `public String` | `previous()` Overloads the `--` operator for the class CharSequence.
    `` | `public String` | `previous(int n)` A variant of previous with an integer count parameter; equivalent to calling previous() count times.
    `` | `public List<String>` | `readLines()` Returns the lines of a CharSequence as a List of String.
    `` | `public String` | `replace(Map<CharSequence, CharSequence> replacements)` Replaces all occurrences of replacement CharSequences (supplied via a map) within a provided CharSequence.
    `` | `public String` | `replace(int capacity, Map<CharSequence, CharSequence> replacements)` Replaces all occurrences of replacement CharSequences (supplied via a map) within a provided CharSequence with control over the internally created StringBuilder's capacity.
    `` | `public String` | `replaceAll(CharSequence regex, CharSequence replacement)` Replaces each substring of this CharSequence that matches the given regular expression with the given replacement.
    `` | `public String` | `replaceAll(CharSequence regex, Closure closure)` Replaces all occurrences of a captured group by the result of calling a closure on that text.
    `` | `public String` | `replaceAll(Pattern pattern, CharSequence replacement)` Replaces all substrings of a CharSequence that match the given compiled regular expression with the given replacement.
    `` | `public String` | `replaceAll(Pattern pattern, Closure closure)` Replaces all occurrences of a captured group by the result of a closure call on that text.
    `` | `public String` | `replaceFirst(CharSequence regex, CharSequence replacement)` Replaces the first substring of this CharSequence that matches the given regular expression with the given replacement.
    `` | `public String` | `replaceFirst(CharSequence regex, Closure closure)` Replaces the first occurrence of a captured group by the result of a closure call on that text.
    `` | `public String` | `replaceFirst(Pattern pattern, CharSequence replacement)` Replaces the first substring of a CharSequence that matches the given compiled regular expression with the given replacement.
    `` | `public String` | `replaceFirst(Pattern pattern, Closure closure)` Replaces the first occurrence of a captured group by the result of a closure call on that text.
    `` | `public String` | `reverse()` Creates a String which is the reverse (backwards) of this CharSequence
    `` | `public String` | `sha256()` Calculate SHA-256 of the CharSequence instance
    `` | `public int` | `size()` Provides the standard Groovy `size()` method for `CharSequence`.
    `` | `public String[]` | `split()` Splits a CharSequence (with whitespace as delimiter).
    `<T>` | `public T` | `splitEachLine(CharSequence regex, Closure<T> closure)` Iterates through the given CharSequence line by line, splitting each line using the given regex delimiter.
    `<T>` | `public T` | `splitEachLine(Pattern pattern, Closure<T> closure)` Iterates through the given CharSequence line by line, splitting each line using the given separator Pattern.
    `` | `public boolean` | `startsWithAny(CharSequence prefixes)` Tests if this CharSequence starts with any specified prefixes.
    `` | `public boolean` | `startsWithIgnoreCase(CharSequence searchString)` Checks whether this CharSequence starts with the `searchString` ignoring the case considerations.
    `` | `public String` | `stripIndent()` Strips leading spaces from every line in a CharSequence.
    `` | `public String` | `stripIndent(boolean forceGroovyBehavior)` Same logic as CharSequence.stripIndent if `forceGroovyBehavior` is `true`, otherwise `stripIndent` from JDK 13+ will be invoked.
    `` | `public String` | `stripIndent(int numChars)` Strips `numChars` leading characters from every line in a CharSequence.
    `` | `public String` | `stripMargin()` Strips leading whitespace/control characters followed by '|' from every line in a CharSequence.
    `` | `public String` | `stripMargin(char marginChar)` Strips leading whitespace/control characters followed by `marginChar` from every line in a CharSequence.
    `` | `public String` | `stripMargin(CharSequence marginChar)` Strips leading whitespace/control characters followed by `marginChar` from every line in a CharSequence.
    `` | `public CharSequence` | `take(int num)` Returns the first `num` elements from this CharSequence.
    `` | `public CharSequence` | `takeAfter(CharSequence searchString)` Returns the `CharSequence` that exists after the first occurrence of the given `searchString` in this CharSequence.
    `` | `public CharSequence` | `takeBefore(CharSequence searchString)` Returns the `CharSequence` that exists before the first occurrence of the given `searchString` in this CharSequence.
    `` | `public CharSequence` | `takeBetween(CharSequence from, CharSequence to)` Returns the CharSequence that is in between the first occurrence of the given `from` and `to` CharSequences and empty if the unavailable inputs are given.
    `` | `public CharSequence` | `takeBetween(CharSequence enclosure)` Takes the characters between the first occurrence of the two subsequent `enclosure` strings.
    `` | `public CharSequence` | `takeBetween(CharSequence from, CharSequence to, int occurrence)` Returns the CharSequence that is in between the given the nth (specified by occurrence) pair of `from` and `to` CharSequences and empty if the unavailable inputs are given.
    `` | `public CharSequence` | `takeBetween(CharSequence enclosure, int occurrence)` Takes the characters between nth (specified by occurrence) pair of `enclosure` strings.
    `` | `public CharSequence` | `takeRight(int num)` Returns the last `num` elements from this CharSequence.
    `` | `public String` | `takeWhile(Closure condition)` Returns the longest prefix of this CharSequence where each element passed to the given closure evaluates to true.
    `` | `public BigDecimal` | `toBigDecimal()` Parses a CharSequence into a BigDecimal
    `` | `public BigInteger` | `toBigInteger()` Parses a CharSequence into a BigInteger
    `` | `public Number` | `toCurrencyNumber(Locale locale)` Parses a CharSequence into a Number using the currency format of the given locale.
    `` | `public Double` | `toDouble()` Parses a CharSequence into a Double.
    `` | `public Float` | `toFloat()` Parses a CharSequence into a Float.
    `` | `public Integer` | `toInteger()` Parses a CharSequence into an Integer.
    `` | `public List<String>` | `toList()` Converts the given CharSequence into a List of Strings of one character.
    `` | `public Long` | `toLong()` Parses a CharSequence into a Long
    `` | `public Number` | `toNumber(Locale locale)` Parses a CharSequence into a Number using the given locale, honouring locale-specific grouping and decimal symbols.
    `` | `public Number` | `toPercentNumber(Locale locale)` Parses a CharSequence into a Number using the percent format of the given locale.
    `` | `public Set<String>` | `toSet()` Converts the given CharSequence into a Set of unique Strings of one character.
    `` | `public Short` | `toShort()` Parses a CharSequence into a Short.
    `` | `public URI` | `toURI()` Transforms a CharSequence representing a URI into a URI object.
    `` | `public URL` | `toURL()` Transforms a CharSequence representing a URL into a URL object.
    `` | `public List<String>` | `tokenize()` Tokenizes a CharSequence (with a whitespace as the delimiter).
    `` | `public List<String>` | `tokenize(Character delimiter)` Tokenizes a CharSequence based on the given character delimiter.
    `` | `public List<String>` | `tokenize(CharSequence delimiters)` Tokenizes a CharSequence based on the given CharSequence.
    `` | `public String` | `tr(CharSequence sourceSet, CharSequence replacementSet)` Translates a CharSequence by replacing characters from the sourceSet with characters from replacementSet.
    `` | `public String` | `uncapitalize()` Convenience method to uncapitalize the first letter of a CharSequence (typically the first letter of a word).
    `` | `public String` | `unexpand()` Replaces sequences of whitespaces with tabs using tabStops of size 8.
    `` | `public String` | `unexpand(int tabStop)` Replaces sequences of whitespaces with tabs.
    `` | `public String` | `unexpandLine(int tabStop)` Replaces sequences of whitespaces with tabs within a line.

- - ### Method Detail

    - #### public boolean asBoolean()

      Coerces a CharSequence to a boolean value. A sequence string is coerced to `false` if it is of length 0, and to `true` otherwise.

      Returns:
        the boolean value
      Since:
        1.7.0

    - #### <T> public T asType(Class<T> c)

      Provides a method to perform custom 'dynamic' type conversion to the given class using the `as` operator.

      Parameters:
        `c` - the desired class
      Returns:
        the converted object
      Since:
        1.8.2
      See Also:
        asType(String,Class)

    - #### public Pattern bitwiseNegate()

      Turns a CharSequence into a regular expression Pattern.

      Returns:
        the regular expression pattern
      Since:
        1.8.2

    - #### public String capitalize()

      Convenience method to capitalize the first letter of a CharSequence (typically the first letter of a word). Example usage:

           assert 'h'.capitalize() == 'H'
           assert 'hello'.capitalize() == 'Hello'
           assert 'hello world'.capitalize() == 'Hello world'
           assert 'Hello World' ==
               'hello world'.split(' ').collect{ it.capitalize() }.join(' ')

      Returns:
        A String containing the capitalized toString() of the CharSequence
      Since:
        1.8.2

    - #### public String center(Number numberOfChars)

      Pads a CharSequence to a minimum length specified by `numberOfChars` by adding the space character around it as many times as needed so that it remains centered.

      If the String is already the same size or bigger than the target `numberOfChars`, then the original String is returned. An example:

           ['A', 'BB', 'CCC', 'DDDD'].each{ println '|' + it.center(6) + '|' }

      will produce output like:

           |  A   |
           |  BB  |
           | CCC  |
           | DDDD |

      Parameters:
        `numberOfChars` - the total minimum number of characters of the result
      Returns:
        the centered toString() of this CharSequence with padded characters around it
      Since:
        1.8.2

    - #### public String center(Number numberOfChars, CharSequence padding)

      Pad a CharSequence to a minimum length specified by `numberOfChars`, appending the supplied padding CharSequence around the original as many times as needed keeping it centered. If the String is already the same size or bigger than the target `numberOfChars`, then the original String is returned. An example:

           ['A', 'BB', 'CCC', 'DDDD'].each{ println '|' + it.center(6, '+') + '|' }

      will produce output like:

           |++A+++|
           |++BB++|
           |+CCC++|
           |+DDDD+|

      Parameters:
        `numberOfChars` - the total minimum number of characters of the resulting CharSequence
        `padding` - the characters used for padding
      Returns:
        the centered toString() of this CharSequence with padded characters around it
      Since:
        1.8.2

    - #### public boolean contains(CharSequence text)

      Provides an implementation of contains() like Collection.contains to make CharSequences more polymorphic.

      Parameters:
        `text` - the CharSequence to look for
      Returns:
        true if this CharSequence contains the given text
      Since:
        1.8.2

    - #### public boolean containsIgnoreCase(CharSequence searchString)

      Checks whether this CharSequence contains the `searchString` ignoring the caseConsiderations.

      Parameters:
        `searchString` - CharSequence being checked against this
      Returns:
        `true` if the character sequence represented by the argument exists in this CharSequence ignoring the case considerations. `false` otherwise. Returns false if the argument is null
      Since:
        3.0.0

    - #### public int count(CharSequence text)

      Counts the number of occurrences of a sub CharSequence.

      Parameters:
        `text` - a sub CharSequence
      Returns:
        the number of occurrences of the given CharSequence inside this CharSequence
      Since:
        1.8.2

    - #### public String denormalize()

      Return a CharSequence with lines (separated by LF, CR/LF, or CR) terminated by the platform specific line separator.

      Returns:
        the denormalized toString() of this CharSequence
      Since:
        1.8.2

    - #### public String digest(String algorithm)

      digest the CharSequence instance

      throws:
        NoSuchAlgorithmException if the algorithm not found
      Returns:
        digested value
      Since:
        2.5.0
      See Also:
        MessageDigest#getInstance(java.lang.String)

    - #### public CharSequence drop(int num)

      Drops the given number of chars from the head of this CharSequence if they are available.

               def text = "Groovy"
               assert text.drop( 0 ) == 'Groovy'
               assert text.drop( 2 ) == 'oovy'
               assert text.drop( 7 ) == ''

      Parameters:
        `num` - the number of characters to drop from this String
      Returns:
        a CharSequence consisting of all characters except the first `num` ones, or else an empty String, if this CharSequence has less than `num` characters.
      Since:
        1.8.1

    - #### public CharSequence dropRight(int num)

      Returns new CharSequence after removing the right `num` chars. Returns empty String if the `num` is greater than the length of the CharSequence.

           def text = "groovy"

           assert text.dropRight(  3 ) == 'gro'
           assert text.dropRight(  6 ) == ''
           assert text.dropRight(  0 ) == 'groovy'
           assert text.dropRight( -1 ) == 'groovy'
           assert text.dropRight( 10 ) == ''

      Parameters:
        `num` - number of characters
      Returns:
        CharSequence after removing the right `num` chars and empty of the `num` is greater than the length of the CharSequence
      Since:
        3.0.0

    - #### public String dropWhile(Closure condition)

      Creates a suffix of the given CharSequence by dropping as many characters as possible from the front of the original CharSequence such that calling the given closure condition evaluates to true when passed each of the dropped characters.

           def text = "Groovy"
           assert text.dropWhile{ false } == 'Groovy'
           assert text.dropWhile{ true } == ''
           assert text.dropWhile{ it < 'Z' } == 'roovy'
           assert text.dropWhile{ it != 'v' } == 'vy'

      Parameters:
        `condition` - the closure that while continuously evaluating to true will cause us to drop elements from the front of the original CharSequence
      Returns:
        the shortest suffix of the given CharSequence such that the given closure condition evaluates to true for each element dropped from the front of the CharSequence
      Since:
        2.0.0

    - #### <T> public T eachLine(Closure<T> closure)

      Iterates through this CharSequence line by line. Each line is passed to the given 1 or 2 arg closure. If a 2 arg closure is found the line count is passed as the second argument.

      throws:
        java.io.IOException if an error occurs
      Parameters:
        `closure` - a closure
      Returns:
        the last value returned by the closure
      Since:
        1.8.2

    - #### <T> public T eachLine(int firstLine, Closure<T> closure)

      Iterates through this CharSequence line by line. Each line is passed to the given 1 or 2 arg closure. If a 2 arg closure is found the line count is passed as the second argument.

      throws:
        java.io.IOException if an error occurs
      Parameters:
        `firstLine` - the line number value used for the first line (default is 1, set to 0 to start counting from 0)
        `closure` - a closure (arg 1 is line, optional arg 2 is line number)
      Returns:
        the last value returned by the closure
      Since:
        1.8.2

    - #### public boolean endsWithAny(CharSequence suffixes)

      Tests if this CharSequence ends with any specified suffixes.

      Returns:
        `true` if this CharSequence ends with any specified suffixes
      Since:
        2.4.14

    - #### public boolean endsWithIgnoreCase(CharSequence searchString)

      Checks whether this CharSequence ends with the `searchString` ignoring the case considerations.

      Parameters:
        `searchString` - CharSequence bring checked against this
      Returns:
        `true` if the character sequence represented by the argument is a suffix of this CharSequence ignoring the case considerations. `false` otherwise. Returns false if the argument is null
      Since:
        3.0.0

    - #### public String expand()

      Expands all tabs into spaces with tabStops of size 8.

      Returns:
        The expanded toString() of this CharSequence
      Since:
        1.8.2

    - #### public String expand(int tabStop)

      Expands all tabs into spaces. If the CharSequence has multiple lines, expand each line - restarting tab stops at the start of each line.

      Parameters:
        `tabStop` - The number of spaces a tab represents
      Returns:
        The expanded toString() of this CharSequence
      Since:
        1.8.2

    - #### public String expandLine(int tabStop)

      Expands all tabs into spaces. Assumes the CharSequence represents a single line of text.

      Parameters:
        `tabStop` - The number of spaces a tab represents
      Returns:
        The expanded toString() of this CharSequence
      Since:
        1.8.2

    - #### public String find(CharSequence regex)

      Finds the first occurrence of a regular expression String within a String. If the regex doesn't match, null will be returned.

      For example, if the regex doesn't match the result is null:

               assert "New York, NY".find(/\d{5}/) == null

      If it does match, we get the matching string back:

                assert "New York, NY 10292-0098".find(/\d{5}/) == "10292"

      If we have capture groups in our expression, we still get back the full match

                assert "New York, NY 10292-0098".find(/(\d{5})-?(\d{4})/) == "10292-0098"

      Parameters:
        `regex` - the capturing regex
      Returns:
        a String containing the matched portion, or null if the regex doesn't match
      Since:
        1.8.2
      See Also:
        find(CharSequence,Pattern)

    - #### public String find(CharSequence regex, Closure closure)

      Returns the result of calling a closure with the first occurrence of a regular expression found within a CharSequence. If the regex doesn't match, the closure will not be called and find will return null.

      Parameters:
        `regex` - the capturing regex CharSequence
        `closure` - the closure that will be passed the full match, plus each of the capturing groups (if any)
      Returns:
        a String containing the result of calling the closure (calling toString() if needed), or null if the regex pattern doesn't match
      Since:
        1.8.2
      See Also:
        find(CharSequence,Pattern,Closure)

    - #### public String find(Pattern pattern)

      Finds the first occurrence of a compiled regular expression Pattern within a String. If the pattern doesn't match, null will be returned.

      For example, if the pattern doesn't match the result is null:

               assert "New York, NY".find(~/\d{5}/) == null

      If it does match, we get the matching string back:

                assert "New York, NY 10292-0098".find(~/\d{5}/) == "10292"

      If we have capture groups in our expression, the groups are ignored and we get back the full match:

                assert "New York, NY 10292-0098".find(~/(\d{5})-?(\d{4})/) == "10292-0098"

      If you need to work with capture groups, then use the closure version of this method or use Groovy's matcher operators or use `eachMatch`.
      Parameters:
        `pattern` - the compiled regex Pattern
      Returns:
        a String containing the matched portion, or null if the regex pattern doesn't match
      Since:
        1.8.2

    - #### public String find(Pattern pattern, Closure closure)

      Returns the result of calling a closure with the first occurrence of a compiled regular expression found within a String. If the regex doesn't match, the closure will not be called and find will return null.

      For example, if the pattern doesn't match, the result is null:

               assert "New York, NY".find(~/\d{5}/) { match -> return "-$match-"} == null

      If it does match and we don't have any capture groups in our regex, there is a single parameter on the closure that the match gets passed to:

                assert "New York, NY 10292-0098".find(~/\d{5}/) { match -> return "-$match-"} == "-10292-"

      If we have capture groups in our expression, our closure has one parameter for the match, followed by one for each of the capture groups:

                assert "New York, NY 10292-0098".find(~/(\d{5})-?(\d{4})/) { match, zip, plusFour ->
                    assert match == "10292-0098"
                    assert zip == "10292"
                    assert plusFour == "0098"
                    return zip
                } == "10292"

      If we have capture groups in our expression, and our closure has one parameter, the closure will be passed an array with the first element corresponding to the whole match, followed by an element for each of the capture groups:

                assert "New York, NY 10292-0098".find(~/(\d{5})-?(\d{4})/) { array ->
                    assert array[0] == "10292-0098"
                    assert array[1] == "10292"
                    assert array[2] == "0098"
                    return array[1]
                } == "10292"

      If a capture group is optional, and doesn't match, then the corresponding value for that capture group passed to the closure will be null as illustrated here:

                assert "adsf 233-9999 adsf".find(~/(\d{3})?-?(\d{3})-(\d{4})/) { match, areaCode, exchange, stationNumber ->
                    assert "233-9999" == match
                    assert null == areaCode
                    assert "233" == exchange
                    assert "9999" == stationNumber
                    return "$exchange$stationNumber"
                } == "2339999"

      Parameters:
        `pattern` - the compiled regex Pattern
        `closure` - the closure that will be passed the full match, plus each of the capturing groups (if any)
      Returns:
        a String containing the result of calling the closure (calling toString() if needed), or null if the regex pattern doesn't match
      Since:
        1.8.2

    - #### public List<String> findAll(CharSequence regex)

      Returns a (possibly empty) list of all occurrences of a regular expression (provided as a CharSequence) found within a CharSequence.

      For example, if the regex doesn't match, it returns an empty list:

           assert "foo".findAll(/(\w*) Fish/) == []

      Any regular expression matches are returned in a list, and all regex capture groupings are ignored, only the full match is returned:

           def expected = ["One Fish", "Two Fish", "Red Fish", "Blue Fish"]
           assert "One Fish, Two Fish, Red Fish, Blue Fish".findAll(/(\w*) Fish/) == expected

      If you need to work with capture groups, then use the closure version of this method or use Groovy's matcher operators or use `eachMatch`.
      Parameters:
        `regex` - the capturing regex CharSequence
      Returns:
        a List containing all full matches of the regex within the CharSequence, an empty list will be returned if there are no matches
      Since:
        1.8.2
      See Also:
        findAll(CharSequence,Pattern)

    - #### <T> public List<T> findAll(CharSequence regex, Closure<T> closure)

      Finds all occurrences of a regular expression string within a CharSequence. Any matches are passed to the specified closure. The closure is expected to have the full match in the first parameter. If there are any capture groups, they will be placed in subsequent parameters.

      If there are no matches, the closure will not be called, and an empty List will be returned.

      For example, if the regex doesn't match, it returns an empty list:

           assert "foo".findAll(/(\w*) Fish/) { match, firstWord -> return firstWord } == []

      Any regular expression matches are passed to the closure, if there are no capture groups, there will be one parameter for the match:

           assert "I could not, would not, with a fox.".findAll(/.ould/) { match -> "${match}n't"} == ["couldn't", "wouldn't"]

      If there are capture groups, the first parameter will be the match followed by one parameter for each capture group:

           def orig = "There's a Wocket in my Pocket"
           assert orig.findAll(/(.)ocket/) { match, firstLetter -> "$firstLetter > $match" } == ["W > Wocket", "P > Pocket"]

      Parameters:
        `regex` - the capturing regex CharSequence
        `closure` - will be passed the full match plus each of the capturing groups (if any)
      Returns:
        a List containing all results from calling the closure with each full match (and potentially capturing groups) of the regex within the CharSequence, an empty list will be returned if there are no matches
      Since:
        1.8.2
      See Also:
        findAll(CharSequence,Pattern,Closure)

    - #### public List<String> findAll(Pattern pattern)

      Returns a (possibly empty) list of all occurrences of a regular expression (in Pattern format) found within a CharSequence.

      For example, if the pattern doesn't match, it returns an empty list:

           assert "foo".findAll(~/(\w*) Fish/) == []

      Any regular expression matches are returned in a list, and all regex capture groupings are ignored, only the full match is returned:

           def expected = ["One Fish", "Two Fish", "Red Fish", "Blue Fish"]
           assert "One Fish, Two Fish, Red Fish, Blue Fish".findAll(~/(\w*) Fish/) == expected

      Parameters:
        `pattern` - the compiled regex Pattern
      Returns:
        a List containing all full matches of the Pattern within the CharSequence, an empty list will be returned if there are no matches
      Since:
        1.8.2

    - #### <T> public List<T> findAll(Pattern pattern, Closure<T> closure)

      Finds all occurrences of a compiled regular expression Pattern within a CharSequence. Any matches are passed to the specified closure. The closure is expected to have the full match in the first parameter. If there are any capture groups, they will be placed in subsequent parameters.

      If there are no matches, the closure will not be called, and an empty List will be returned.

      For example, if the pattern doesn't match, it returns an empty list:

           assert "foo".findAll(~/(\w*) Fish/) { match, firstWord -> return firstWord } == []

      Any regular expression matches are passed to the closure, if there are no capture groups, there will be one parameter for the match:

           assert "I could not, would not, with a fox.".findAll(~/.ould/) { match -> "${match}n't"} == ["couldn't", "wouldn't"]

      If there are capture groups, the first parameter will be the match followed by one parameter for each capture group:

           def orig = "There's a Wocket in my Pocket"
           assert orig.findAll(~/(.)ocket/) { match, firstLetter -> "$firstLetter > $match" } == ["W > Wocket", "P > Pocket"]

      Parameters:
        `pattern` - the compiled regex Pattern
        `closure` - will be passed the full match plus each of the capturing groups (if any)
      Returns:
        a List containing all results from calling the closure with each full match (and potentially capturing groups) of the regex pattern within the CharSequence, an empty list will be returned if there are no matches
      Since:
        1.8.2

    - #### public List<List<String>> findAllGroups(CharSequence regex)

      Returns a (possibly empty) list of all occurrences of a regular expression within a CharSequence, with each occurrence represented by a List containing the full match followed by each capture group.

           def input = "Type=apple Price=2.34; Type=pear Price=3.56"
           def pairs = input.findAllGroups(/Type=(\w+) Price=([\d.]+)/).collect { all, t, p -> "$t:$p" }
           assert pairs == ["apple:2.34", "pear:3.56"]

           assert "none here".findAllGroups(/Type=(\w+) Price=([\d.]+)/) == []

      Parameters:
        `regex` - the capturing regex CharSequence
      Returns:
        a List of Lists, one per match, each containing the full match followed by each capture group; an empty List if there are no matches
      Since:
        6.0.0
      See Also:
        findAllGroups(CharSequence,Pattern)

    - #### public List<List<String>> findAllGroups(Pattern pattern)

      Returns a (possibly empty) list of all occurrences of a compiled regular expression Pattern within a CharSequence, with each occurrence represented by a List containing the full match followed by each capture group.

           def input = "Type=apple Price=2.34; Type=pear Price=3.56"
           def pairs = input.findAllGroups(~/Type=(\w+) Price=([\d.]+)/).collect { all, t, p -> "$t:$p" }
           assert pairs == ["apple:2.34", "pear:3.56"]

           assert "none here".findAllGroups(~/Type=(\w+) Price=([\d.]+)/) == []

      Parameters:
        `pattern` - the compiled regex Pattern
      Returns:
        a List of Lists, one per match, each containing the full match followed by each capture group; an empty List if there are no matches
      Since:
        6.0.0

    - #### public List<BalancedGroup> findBalancedGroups(String openRegex, String closeRegex)

      Finds balanced (nested) groups in this CharSequence using default options (no ignore pattern; opening and closing delimiters are kept in the match text).

      This is Groovy's structured alternative to .NET regex balancing groups (`(?<Open>â€¦)` / `(?<Close-Open>â€¦)` / `(?(Open)(?!))`). Delegates to BalancedGroup#find(CharSequence, String, String)#find(CharSequence, String, String). Java Pattern cannot express capture-stack push/pop, so nesting is resolved with an explicit stack and the result is a tree of BalancedGroup nodes (with BalancedGroup#getStart()#getStart()/BalancedGroup#getEnd()#getEnd() offsets comparable to .NET `Capture.Index`/`Length`).

           def text = 'Root: (A + (B * C) + (D(E)))'
           def roots = text.findBalancedGroups(/\(/, /\)/)
           assert roots.size() == 1
           assert roots[0].matchedString == '(A + (B * C) + (D(E)))'
           assert roots[0].children*.matchedString == ['(B * C)', '(D(E))']
           assert roots[0].children[1].children[0].matchedString == '(E)'
           assert text.substring(roots[0].start, roots[0].end) == roots[0].matchedString
           assert roots[0].children[0].depth == 1

      Unmatched closers are ignored; unclosed openers are dropped but completed groups nested inside them are still returned (more tolerant than a strict .NET `(?(Open)(?!))` whole-string match).

      throws:
        NullPointerException if `self`, `openRegex`, or `closeRegex` is `null`
      throws:
        IllegalArgumentException if `openRegex` or `closeRegex` is empty
      throws:
        java.util.regex.PatternSyntaxException if a pattern is not a valid Java regex
      Parameters:
        `openRegex` - regular expression for the opening delimiter (must not be empty)
        `closeRegex` - regular expression for the closing delimiter (must not be empty)
      Returns:
        an unmodifiable list of outermost BalancedGroup nodes (empty if none)
      See Also:
        BalancedGroup#find(CharSequence, String, String)#find(CharSequence, String, String)
        findBalancedGroups(CharSequence, String, String, BalancedGroup.MatchOptions)
      Since:
        6.0.0

    - #### public List<BalancedGroup> findBalancedGroups(String openRegex, String closeRegex, MatchOptions options)

      Finds balanced (nested) groups in this CharSequence with the given options. Delegates to BalancedGroup#find(CharSequence, String, String, BalancedGroup.MatchOptions).

           import groovy.util.regex.BalancedGroup
           def opts = BalancedGroup.MatchOptions.defaults().withIncludeEdges(false)
           def g = 'func(arg1, arg2)'.findBalancedGroups(/\(/, /\)/, opts)[0]
           assert g.matchedString == 'arg1, arg2'
           assert g.start == 5 && g.end == 15
           assert g.fullStart == 4 && g.fullEnd == 16

           def code = 'if (true) { String s = "}"; }'
           def ignoreStrings = BalancedGroup.MatchOptions.defaults()
               .withIgnoreRegex(/"(?:\\.|[^"\\])*"/)
           assert code.findBalancedGroups(/\{/, /\}/, ignoreStrings)[0].matchedString == '{ String s = "}"; }'

      BalancedGroup.MatchOptions#includeEdges()`false` keeps only the interior text (like .NET's balancing capture of the interval between the open capture and the close). BalancedGroup.MatchOptions#ignoreRegex() skips spans such as string literalsâ€”the usual substitute for a hand-built â€œneither delimiterâ€? class in a .NET balancing pattern.

      If `options` is `null`, BalancedGroup.MatchOptions#defaults() is used. Named groups `OPEN`, `CLOSE`, and `IGNORE` are reserved by the scanner.

      throws:
        NullPointerException if `self`, `openRegex`, or `closeRegex` is `null`
      throws:
        IllegalArgumentException if `openRegex` or `closeRegex` is empty
      throws:
        java.util.regex.PatternSyntaxException if a pattern is not a valid Java regex
      Parameters:
        `openRegex` - regular expression for the opening delimiter (must not be empty)
        `closeRegex` - regular expression for the closing delimiter (must not be empty)
        `options` - match options, or `null` for defaults
      Returns:
        an unmodifiable list of outermost BalancedGroup nodes (empty if none)
      See Also:
        BalancedGroup#find(CharSequence, String, String, BalancedGroup.MatchOptions)
        findBalancedGroups(CharSequence, String, String)
      Since:
        6.0.0

    - #### public List<String> findGroups(CharSequence regex)

      Finds the first occurrence of a regular expression within a CharSequence and returns the full match followed by each capture group as a List. If the regex doesn't match, an empty List is returned. Because multi-assignment pads missing elements with null, the same destructuring expression works whether or not the regex matches:

           def (all, zip, plus4) = "New York, NY 10292-0098".findGroups(/(\d{5})-(\d{4})/)
           assert all == "10292-0098"
           assert zip == "10292"
           assert plus4 == "0098"

           def (a2, z2, p2) = "New York, NY".findGroups(/(\d{5})-(\d{4})/)
           assert [a2, z2, p2] == [null, null, null]

      Parameters:
        `regex` - the capturing regex CharSequence
      Returns:
        a List containing the full match followed by each capture group, or an empty List if there is no match
      Since:
        6.0.0
      See Also:
        findGroups(CharSequence,Pattern)

    - #### public List<String> findGroups(Pattern pattern)

      Finds the first occurrence of a compiled regular expression Pattern within a CharSequence and returns the full match followed by each capture group as a List. If the pattern doesn't match, an empty List is returned.

           def (all, zip, plus4) = "New York, NY 10292-0098".findGroups(~/(\d{5})-(\d{4})/)
           assert all == "10292-0098"
           assert zip == "10292"
           assert plus4 == "0098"

           assert "New York, NY".findGroups(~/(\d{5})-(\d{4})/) == []
           def (a2, z2, p2) = "New York, NY".findGroups(~/(\d{5})-(\d{4})/)
           assert [a2, z2, p2] == [null, null, null]

      Parameters:
        `pattern` - the compiled regex Pattern
      Returns:
        a List containing the full match followed by each capture group, or an empty List if there is no match
      Since:
        6.0.0

    - #### public String getAt(Collection indices)

      Selects a List of characters from a CharSequence using a Collection to identify the indices to be selected.

      Parameters:
        `indices` - a Collection of indices
      Returns:
        a String consisting of the characters at the given indices
      Since:
        1.0

    - #### public String getAt(EmptyRange range)

      Supports the range subscript operator for CharSequence or StringBuffer with EmptyRange

      Parameters:
        `range` - an EmptyRange
      Returns:
        the empty String
      Since:
        1.5.0

    - #### public CharSequence getAt(int index)

      Supports the subscript operator for CharSequence.

      Parameters:
        `index` - the index of the Character to get
      Returns:
        the Character at the given index
      Since:
        1.0

    - #### public CharSequence getAt(IntRange range)

      Supports the range subscript operator for CharSequence with IntRange.

      Parameters:
        `range` - an IntRange
      Returns:
        the subsequence CharSequence
      Since:
        1.0

    - #### public CharSequence getAt(Range range)

      Supports the range subscript operator for CharSequence.

      Parameters:
        `range` - a Range
      Returns:
        the subsequence CharSequence
      Since:
        1.0

    - #### public char[] getChars()

      Converts the given CharSequence into an array of characters.

      Returns:
        an array of characters
      Since:
        1.8.2

    - #### public int[] getCodePoints()

      Converts the given CharSequence into an array of code point values including any surrogate pairs as per String.codePoints.

      Returns:
        an array of ints
      Since:
        5.0.0

    - #### public boolean isAllWhitespace()

      Returns true if a CharSequence only contains whitespace characters.

      Returns:
        true If all characters are whitespace characters
      Since:
        1.8.2

    - #### public boolean isBigDecimal()

      Determines if a CharSequence can be parsed as a BigDecimal.

      Returns:
        true if the CharSequence can be parsed
      Since:
        1.8.2

    - #### public boolean isBigInteger()

      Determines if a CharSequence can be parsed as a BigInteger.

      Returns:
        true if the CharSequence can be parsed
      Since:
        1.8.2

    - #### public boolean isBlank()

      Tests if this CharSequence is blank.

      Returns:
        `true` if this CharSequence is blank
      Since:
        2.5.0
      See Also:
        isAllWhitespace(CharSequence)

    - #### public boolean isCase(Object switchValue)

      'Case' implementation for a CharSequence, which uses equals between the toString() of the caseValue and the switchValue. This allows CharSequence values to be used in switch statements. For example:

           switch( str ) {
             case 'one' :
             // etc...
           }

      Note that this returns `true` for the case where both the 'switch' and 'case' operand is `null`.
      Parameters:
        `switchValue` - the switch value
      Returns:
        true if the switchValue's toString() equals the caseValue
      Since:
        1.8.2

    - #### public boolean isDouble()

      Determines if a CharSequence can be parsed as a Double.

      Returns:
        true if the CharSequence can be parsed
      Since:
        1.8.2

    - #### public boolean isFloat()

      Determines if a CharSequence can be parsed as a Float.

      Returns:
        true if the CharSequence can be parsed
      Since:
        1.8.2

    - #### public boolean isInteger()

      Determines if a CharSequence can be parsed as an Integer.

      Returns:
        true if the CharSequence can be parsed
      Since:
        1.8.2

    - #### public boolean isLong()

      Determines if a CharSequence can be parsed as a Long.

      Returns:
        true if the CharSequence can be parsed
      Since:
        1.8.2

    - #### public boolean isNotCase(Object switchValue)

      Since:
        4.0.0

    - #### public boolean isNumber()

      Determines if a CharSequence can be parsed as a Number.

      Returns:
        true if the CharSequence can be parsed
      Since:
        1.8.2
      See Also:
        isBigDecimal(CharSequence)

    - #### public StringBuilder leftShift(Object value)

      Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a CharSequence.

      Parameters:
        `value` - an Object
      Returns:
        a StringBuilder built from this CharSequence
      Since:
        1.8.2

    - #### public boolean matches(Pattern pattern)

      Determines if a CharSequence matches the given regular expression.

      Parameters:
        `pattern` - the regex Pattern to which the string of interest is to be matched
      Returns:
        true if the CharSequence matches
      Since:
        1.8.2
      See Also:
        String.matches

    - #### public String md5()

      Calculate md5 of the CharSequence instance

      throws:
        NoSuchAlgorithmException if MD5 algorithm not found
      Returns:
        md5 value
      Since:
        2.5.0

    - #### public String minus(Object target)

      Removes a part of a CharSequence by replacing the first occurrence of target within self with empty string and returns the result.

      Parameters:
        `target` - an object representing the part to remove
      Returns:
        a String containing the original minus the part to be removed
      Since:
        1.8.2

    - #### public String minus(Pattern pattern)

      Removes a part of a CharSequence. This replaces the first occurrence of the pattern within self with empty string and returns the result.

      Parameters:
        `pattern` - a Pattern representing the part to remove
      Returns:
        a String minus the part to be removed
      Since:
        2.2.0

    - #### public String multiply(Number factor)

      Repeats a CharSequence a certain number of times.

      throws:
        IllegalArgumentException if the number of repetitions is < 0
      Parameters:
        `factor` - the number of times the CharSequence should be repeated
      Returns:
        a String composed of a repetition
      Since:
        1.8.2

    - #### public String next()

      Overloads the `++` operator for the class CharSequence. It increments the last character in the given CharSequence. If the last character in the CharSequence is Character.MAX_VALUE a Character.MIN_VALUE will be appended. The empty CharSequence is incremented to a string consisting of the character Character.MIN_VALUE.

      Returns:
        a value obtained by incrementing the toString() of the CharSequence
      Since:
        1.8.2

    - #### public String next(int n)

      A variant of next with an integer count parameter; equivalent to calling next() count times.

           assert 'a'.next(1) == 'a'.next()
           assert 'a'.next(4) == 'e'
           assert 'a'.next(0) == 'a'
           assert 'a'.next(25) == 'z'
           assert 'A'.next(32) == 'a'
           assert (0..4).collect('a'::next) == 'a'..'e'
           assert 'car'.next(2) == 'cat'

      Parameters:
        `n` - how many times to increment
      See Also:
        next(CharSequence)
      Returns:
        a value obtained by incrementing the toString() of the CharSequence n times
      Since:
        5.0.0

    - #### public String normalize()

      Returns a String with linefeeds and carriage returns normalized to linefeeds.

      Returns:
        the normalized toString() for the CharSequence
      Since:
        1.8.2

    - #### public String padLeft(Number numberOfChars)

      Pads a CharSequence to a minimum length specified by `numberOfChars` by adding the space character to the left as many times as needed. If the String is already the same size or bigger than the target `numberOfChars`, then the original String is returned. An example:

           println 'Numbers:'
           [1, 10, 100, 1000].each{ println it.toString().padLeft(5) }

      will produce output like:

           Numbers:
               1
              10
             100
            1000

      Parameters:
        `numberOfChars` - the total minimum number of characters of the resulting CharSequence
      Returns:
        the CharSequence padded to the left as a String
      Since:
        1.8.2
      See Also:
        padLeft(CharSequence,Number,CharSequence)

    - #### public String padLeft(Number numberOfChars, CharSequence padding)

      Pads a CharSequence to a minimum length specified by `numberOfChars`, adding the supplied padding CharSequence as many times as needed to the left. If the CharSequence is already the same size or bigger than the target `numberOfChars`, then the toString() of the original CharSequence is returned. An example:

           println 'Numbers:'
           [1, 10, 100, 1000].each{ println it.toString().padLeft(5, '*') }
           [2, 20, 200, 2000].each{ println it.toString().padLeft(5, '*_') }

      will produce output like:

           Numbers:
           ****1
           ***10
           **100
           *1000
           *_*_2
           *_*20
           *_200
           *2000

      Parameters:
        `numberOfChars` - the total minimum number of characters of the resulting CharSequence
        `padding` - the characters used for padding
      Returns:
        the CharSequence padded to the left as a String
      Since:
        1.8.2

    - #### public String padRight(Number numberOfChars)

      Pads a CharSequence to a minimum length specified by `numberOfChars` by adding the space character to the right as many times as needed. If the CharSequence is already the same size or bigger than the target `numberOfChars`, then the toString() of the original CharSequence is returned. An example:

           ['A', 'BB', 'CCC', 'DDDD'].each{ println it.padRight(5) + it.size() }

      will produce output like:

           A    1
           BB   2
           CCC  3
           DDDD 4

      Parameters:
        `numberOfChars` - the total minimum number of characters of the resulting string
      Returns:
        the CharSequence padded to the right as a String
      Since:
        1.8.2

    - #### public String padRight(Number numberOfChars, CharSequence padding)

      Pads a CharSequence to a minimum length specified by `numberOfChars`, adding the supplied padding CharSequence as many times as needed to the right. If the CharSequence is already the same size or bigger than the target `numberOfChars`, then the toString() of the original CharSequence is returned. An example:

           ['A', 'BB', 'CCC', 'DDDD'].each{ println it.padRight(5, '#') + it.size() }

      will produce output like:

           A####1
           BB###2
           CCC##3
           DDDD#4

      Parameters:
        `numberOfChars` - the total minimum number of characters of the resulting CharSequence
        `padding` - the characters used for padding
      Returns:
        the CharSequence padded to the right as a String
      Since:
        1.8.2

    - #### public String plus(Object right)

      Appends the String representation of the given operand to this CharSequence.

      Parameters:
        `right` - any Object
      Returns:
        the original toString() of the CharSequence with the object appended
      Since:
        1.8.2

    - #### public String previous()

      Overloads the `--` operator for the class CharSequence. It decrements the last character in the given CharSequence. If the last character in the CharSequence is Character.MIN_VALUE it will be deleted. The empty CharSequence can't be decremented.

      Returns:
        a String with a decremented character at the end
      Since:
        1.8.2

    - #### public String previous(int n)

      A variant of previous with an integer count parameter; equivalent to calling previous() count times.

           assert 'b'.previous(1) == 'b'.previous()
           assert 'e'.previous(4) == 'a'
           assert 'a'.previous(0) == 'a'
           assert 'z'.previous(25) == 'a'
           assert 'a'.previous(32) == 'A'
           assert (0..4).collect('z'::previous) == 'z'..'v'
           assert 'cat'.previous(2) == 'car'

      Parameters:
        `n` - how many times to decrement
      See Also:
        previous(CharSequence)
      Returns:
        a value obtained by decrementing the toString() of the CharSequence n times
      Since:
        5.0.0

    - #### public List<String> readLines()

      Returns the lines of a CharSequence as a List of String.

      Returns:
        a list of lines
      Since:
        1.8.2

    - #### public String replace(Map<CharSequence, CharSequence> replacements)

      Replaces all occurrences of replacement CharSequences (supplied via a map) within a provided CharSequence.

           assert 'foobar'.replace(f:'b', foo:'bar') == 'boobar'
           assert 'foobar'.replace(foo:'bar', f:'b') == 'barbar'
           def replacements = [foo:'bar', f:'b', b: 'f', bar:'boo']
           assert 'foobar'.replace(replacements) == 'barfar'

      Parameters:
        `replacements` - a map of before (key) and after (value) pairs processed in the natural order of the map
      Returns:
        a String formed from the provided CharSequence after performing all of the replacements
      Since:
        2.5.0

    - #### public String replace(int capacity, Map<CharSequence, CharSequence> replacements)

      Replaces all occurrences of replacement CharSequences (supplied via a map) within a provided CharSequence with control over the internally created StringBuilder's capacity. This method uses a StringBuilder internally. Java auto-expands a StringBuilder's capacity if needed. In rare circumstances, the overhead involved with repeatedly expanding the StringBuilder may become significant. If you have measured the performance of your application and found this to be a significant bottleneck, use this variant to have complete control over the internally created StringBuilder's capacity.

           assert 'foobar'.replace(9, [r:'rbaz']) == 'foobarbaz'
           assert 'foobar'.replace(1, [fooba:'']) == 'r'

      Parameters:
        `capacity` - an optimization parameter, set to size after replacements or a little larger to avoid resizing overheads
        `replacements` - a map of before (key) and after (value) pairs processed in the natural order of the map
      Returns:
        a String formed from the provided CharSequence after performing all of the replacements
      Since:
        2.5.0

    - #### public String replaceAll(CharSequence regex, CharSequence replacement)

      Replaces each substring of this CharSequence that matches the given regular expression with the given replacement.

           assert "foo".replaceAll('o', 'X') == 'fXX'

      throws:
        java.util.regex.PatternSyntaxException if the regular expression's syntax is invalid
      Parameters:
        `regex` - the capturing regex
        `replacement` - the string to be substituted for each match
      Returns:
        the toString() of the CharSequence with content replaced
      Since:
        1.8.2
      See Also:
        String.replaceAll

    - #### public String replaceAll(CharSequence regex, Closure closure)

      Replaces all occurrences of a captured group by the result of calling a closure on that text.

      Examples:

               assert "hello world".replaceAll("(o)") { it[0].toUpperCase() } == "hellO wOrld"

               assert "foobar-FooBar-".replaceAll("(([fF][oO]{2})[bB]ar)", { Object[] it -> it[0].toUpperCase() }) == "FOOBAR-FOOBAR-"

               // Here,
               //   it[0] is the global string of the matched group
               //   it[1] is the first string in the matched group
               //   it[2] is the second string in the matched group

               assert "foobar-FooBar-".replaceAll("(([fF][oO]{2})[bB]ar)", { x, y, z -> z.toUpperCase() }) == "FOO-FOO-"

               // Here,
               //   x is the global string of the matched group
               //   y is the first string in the matched group
               //   z is the second string in the matched group

      Note that unlike String.replaceAll(String regex, String replacement), where the replacement string treats '$' and '\' specially (for group substitution), the result of the closure is converted to a string and that value is used literally for the replacement.
      throws:
        java.util.regex.PatternSyntaxException if the regular expression's syntax is invalid
      Parameters:
        `regex` - the capturing regex
        `closure` - the closure to apply on each captured group
      Returns:
        the toString() of the CharSequence with content replaced
      Since:
        1.8.2
      See Also:
        replaceAll(CharSequence,Pattern,Closure)

    - #### public String replaceAll(Pattern pattern, CharSequence replacement)

      Replaces all substrings of a CharSequence that match the given compiled regular expression with the given replacement.

      Note that backslashes (`\`) and dollar signs (`$`) in the replacement string may cause the results to be different from if it were being treated as a literal replacement string; see Matcher.replaceAll. Use Matcher.quoteReplacement to suppress the special meaning of these characters, if desired.

           assert "foo".replaceAll(~'o', 'X') == 'fXX'

      Parameters:
        `pattern` - the regex Pattern to which the CharSequence of interest is to be matched
        `replacement` - the CharSequence to be substituted for the first match
      Returns:
        the toString() of the CharSequence with content replaced
      Since:
        1.8.2

    - #### public String replaceAll(Pattern pattern, Closure closure)

      Replaces all occurrences of a captured group by the result of a closure call on that text.

      For examples,

               assert "hello world".replaceAll(~"(o)") { it[0].toUpperCase() } == "hellO wOrld"

               assert "foobar-FooBar-".replaceAll(~"(([fF][oO]{2})[bB]ar)", { it[0].toUpperCase() }) == "FOOBAR-FOOBAR-"

               // Here,
               //   it[0] is the global string of the matched group
               //   it[1] is the first string in the matched group
               //   it[2] is the second string in the matched group

               assert "foobar-FooBar-".replaceAll(~"(([fF][oO]{2})[bB]ar)", { Object[] it -> it[0].toUpperCase() }) == "FOOBAR-FOOBAR-"

               // Here,
               //   it[0] is the global string of the matched group
               //   it[1] is the first string in the matched group
               //   it[2] is the second string in the matched group

               assert "foobar-FooBar-".replaceAll("(([fF][oO]{2})[bB]ar)", { x, y, z -> z.toUpperCase() }) == "FOO-FOO-"

               // Here,
               //   x is the global string of the matched group
               //   y is the first string in the matched group
               //   z is the second string in the matched group

      Note that unlike String.replaceAll(String regex, String replacement), where the replacement string treats '$' and '\' specially (for group substitution), the result of the closure is converted to a string and that value is used literally for the replacement.
      Parameters:
        `pattern` - the capturing regex Pattern
        `closure` - the closure to apply on each captured group
      Returns:
        the toString() of the CharSequence with replaced content
      Since:
        1.8.2
      See Also:
        Matcher.quoteReplacement

    - #### public String replaceFirst(CharSequence regex, CharSequence replacement)

      Replaces the first substring of this CharSequence that matches the given regular expression with the given replacement.

      throws:
        java.util.regex.PatternSyntaxException if the regular expression's syntax is invalid
      Parameters:
        `regex` - the capturing regex
        `replacement` - the CharSequence to be substituted for each match
      Since:
        1.8.2
      See Also:
        String.replaceFirst

    - #### public String replaceFirst(CharSequence regex, Closure closure)

      Replaces the first occurrence of a captured group by the result of a closure call on that text.

      For example (with some replaceAll variants thrown in for comparison purposes),

           assert "hello world".replaceFirst("(o)") { it[0].toUpperCase() } == "hellO world" // first match
           assert "hello world".replaceAll("(o)") { it[0].toUpperCase() } == "hellO wOrld" // all matches

           assert "one fish, two fish".replaceFirst(/([a-z]{3})\s([a-z]{4})/) { [one:1, two:2][it[1]] + '-' + it[2].toUpperCase() } == '1-FISH, two fish'
           assert "one fish, two fish".replaceAll(/([a-z]{3})\s([a-z]{4})/) { [one:1, two:2][it[1]] + '-' + it[2].toUpperCase() } == '1-FISH, 2-FISH'

      throws:
        java.util.regex.PatternSyntaxException if the regular expression's syntax is invalid
      Parameters:
        `regex` - the capturing regex
        `closure` - the closure to apply on the first captured group
      Since:
        1.8.2

    - #### public String replaceFirst(Pattern pattern, CharSequence replacement)

      Replaces the first substring of a CharSequence that matches the given compiled regular expression with the given replacement.

      Note that backslashes (`\`) and dollar signs (`$`) in the replacement string may cause the results to be different from if it were being treated as a literal replacement string; see Matcher.replaceFirst. Use Matcher.quoteReplacement to suppress the special meaning of these characters, if desired.

           assert "foo".replaceFirst('o', 'X') == 'fXo'

      Parameters:
        `pattern` - the regex Pattern to which the CharSequence of interest is to be matched
        `replacement` - the CharSequence to be substituted for the first match
      Since:
        1.8.2

    - #### public String replaceFirst(Pattern pattern, Closure closure)

      Replaces the first occurrence of a captured group by the result of a closure call on that text.

      For example (with some replaceAll variants thrown in for comparison purposes),

           assert "hellO world" == "hello world".replaceFirst(~"(o)") { it[0].toUpperCase() } // first match
           assert "hellO wOrld" == "hello world".replaceAll(~"(o)") { it[0].toUpperCase() }   // all matches

           assert '1-FISH, two fish' == "one fish, two fish".replaceFirst(~/([a-z]{3})\s([a-z]{4})/) { [one:1, two:2][it[1]] + '-' + it[2].toUpperCase() }
           assert '1-FISH, 2-FISH' == "one fish, two fish".replaceAll(~/([a-z]{3})\s([a-z]{4})/) { [one:1, two:2][it[1]] + '-' + it[2].toUpperCase() }

      Parameters:
        `pattern` - the capturing regex Pattern
        `closure` - the closure to apply on the first captured group
      Since:
        1.8.2

    - #### public String reverse()

      Creates a String which is the reverse (backwards) of this CharSequence

      Returns:
        a new String with all the characters reversed.
      Since:
        1.8.2

    - #### public String sha256()

      Calculate SHA-256 of the CharSequence instance

      throws:
        NoSuchAlgorithmException if SHA-256 algorithm not found
      Returns:
        SHA-256 value
      Since:
        2.5.3

    - #### public int size()

      Provides the standard Groovy `size()` method for `CharSequence`.

      Returns:
        the length of the CharSequence
      Since:
        1.8.2

    - #### public String[] split()

      Splits a CharSequence (with whitespace as delimiter). Similar to tokenize, but returns an Array of String instead of a List.

      Returns:
        String[] result of split
      Since:
        1.8.2

    - #### <T> public T splitEachLine(CharSequence regex, Closure<T> closure)

      Iterates through the given CharSequence line by line, splitting each line using the given regex delimiter. The list of tokens for each line is then passed to the given closure.

      throws:
        java.io.IOException if an error occurs
      throws:
        java.util.regex.PatternSyntaxException if the regular expression's syntax is invalid
      Parameters:
        `regex` - the delimiting regular expression
        `closure` - a closure
      Returns:
        the last value returned by the closure
      Since:
        1.8.2
      See Also:
        splitEachLine(CharSequence,Pattern,Closure)

    - #### <T> public T splitEachLine(Pattern pattern, Closure<T> closure)

      Iterates through the given CharSequence line by line, splitting each line using the given separator Pattern. The list of tokens for each line is then passed to the given closure.

      Parameters:
        `pattern` - the regular expression Pattern for the delimiter
        `closure` - a closure
      Returns:
        the last value returned by the closure
      Since:
        1.8.2

    - #### public boolean startsWithAny(CharSequence prefixes)

      Tests if this CharSequence starts with any specified prefixes.

      Returns:
        `true` if this CharSequence starts with any specified prefixes.
      Since:
        2.4.14

    - #### public boolean startsWithIgnoreCase(CharSequence searchString)

      Checks whether this CharSequence starts with the `searchString` ignoring the case considerations.

      Parameters:
        `searchString` - CharSequence being checked against this
      Returns:
        `true` if the character sequence represented by the argument is a prefix of this CharSequence ignoring the case considerations. `false` otherwise. Returns false if the argument is null
      Since:
        3.0.0

    - #### public String stripIndent()

      Strips leading spaces from every line in a CharSequence. The line with the least number of leading spaces determines the number to remove. Lines only containing whitespace are ignored when calculating the number of leading spaces to strip.

           assert '  A\n B\nC' == '   A\n  B\n C'.stripIndent()

      Returns:
        the stripped `toString()` of the CharSequence
      Since:
        1.8.2

    - #### public String stripIndent(boolean forceGroovyBehavior)

      Same logic as CharSequence.stripIndent if `forceGroovyBehavior` is `true`, otherwise `stripIndent` from JDK 13+ will be invoked.

      Parameters:
        `forceGroovyBehavior` - force groovy behavior to avoid conflicts with Java stripIndent
      Since:
        3.0.0

    - #### public String stripIndent(int numChars)

      Strips `numChars` leading characters from every line in a CharSequence.

           assert 'DEF\n456' == '''ABCDEF\n123456'''.stripIndent(3)

      Parameters:
        `numChars` - The number of characters to strip
      Returns:
        the stripped String
      Since:
        1.8.2

    - #### public String stripMargin()

      Strips leading whitespace/control characters followed by '|' from every line in a CharSequence.

           assert 'ABC\n123\n456' == '''ABC
                                       |123
                                       |456'''.stripMargin()

      Returns:
        the stripped String
      Since:
        1.8.2
      See Also:
        stripMargin(CharSequence,char)

    - #### public String stripMargin(char marginChar)

      Strips leading whitespace/control characters followed by `marginChar` from every line in a CharSequence.

           assert 'ABC\n123\n456' == '''ABC
                                       *123
                                       *456'''.stripMargin('*')

      Parameters:
        `marginChar` - Any character that serves as margin delimiter
      Returns:
        the stripped String
      Since:
        1.8.2

    - #### public String stripMargin(CharSequence marginChar)

      Strips leading whitespace/control characters followed by `marginChar` from every line in a CharSequence.

      Parameters:
        `marginChar` - Any character that serves as margin delimiter
      Returns:
        the stripped CharSequence
      Since:
        1.8.2

    - #### public CharSequence take(int num)

      Returns the first `num` elements from this CharSequence.

           def text = "Groovy"
           assert text.take( 0 ) == ''
           assert text.take( 2 ) == 'Gr'
           assert text.take( 7 ) == 'Groovy'

      Parameters:
        `num` - the number of chars to take from this CharSequence
      Returns:
        a CharSequence consisting of the first `num` chars, or else the whole CharSequence if it has less than `num` elements.
      Since:
        1.8.1

    - #### public CharSequence takeAfter(CharSequence searchString)

      Returns the `CharSequence` that exists after the first occurrence of the given `searchString` in this CharSequence.

           def text = "Groovy development. Groovy team"
           assert text.takeAfter( 'Groovy' )           == ' development. Groovy team'
           assert text.takeAfter( 'team' )             == ''
           assert text.takeAfter( '' )                 == ''
           assert text.takeAfter( 'Unavailable text' ) == ''
           assert text.takeAfter( null )               == ''

      Parameters:
        `searchString` - CharSequence that is searched in this CharSequence
      Returns:
        CharSequence that is after the given searchString and empty string if it does not exist
      Since:
        3.0.0

    - #### public CharSequence takeBefore(CharSequence searchString)

      Returns the `CharSequence` that exists before the first occurrence of the given `searchString` in this CharSequence.

           def text = "Groovy development. Groovy team"

           assert text.takeBefore( ' Groovy ' )         == 'Groovy development.'
           assert text.takeBefore( ' ' )                == 'Groovy'
           assert text.takeBefore( 'Unavailable text' ) == ''
           assert text.takeBefore( null )               == ''

      Parameters:
        `searchString` - CharSequence that is searched in this CharSequence
      Returns:
        CharSequence that is before the given searchString
      Since:
        3.0.0

    - #### public CharSequence takeBetween(CharSequence from, CharSequence to)

      Returns the CharSequence that is in between the first occurrence of the given `from` and `to` CharSequences and empty if the unavailable inputs are given.

           def text = "Groovy"

           assert text.takeBetween( 'r', 'v' ) == 'oo'
           assert text.takeBetween( 'r', 'z' ) == ''
           assert text.takeBetween( 'a', 'r' ) == ''

      Parameters:
        `from` - beginning of search
        `to` - end of search
      Returns:
        the CharSequence that is in between the given two CharSequences and empty if the unavailable inputs are given
      Since:
        3.0.0
      See Also:
        takeBetween(CharSequence,CharSequence,CharSequence,int)

    - #### public CharSequence takeBetween(CharSequence enclosure)

      Takes the characters between the first occurrence of the two subsequent `enclosure` strings.

           def text = "name = 'some name'"

           assert text.takeBetween( "'" ) == 'some name'
           assert text.takeBetween( 'z' ) == ''

      Parameters:
        `enclosure` - Enclosure CharSequence
      Returns:
        CharSequence between the 2 subsequent `enclosure` strings
      Since:
        3.0.0
      See Also:
        takeBetween(CharSequence,CharSequence,int)

    - #### public CharSequence takeBetween(CharSequence from, CharSequence to, int occurrence)

      Returns the CharSequence that is in between the given the nth (specified by occurrence) pair of `from` and `to` CharSequences and empty if the unavailable inputs are given.

           def text = "t1=10 ms, t2=100 ms"

           assert text.takeBetween( '=', ' ', 0 ) == '10'
           assert text.takeBetween( '=', ' ', 1 ) == '100'
           assert text.takeBetween( 't1', 'z' ) == ''

      Parameters:
        `from` - beginning of search
        `to` - end of search
        `occurrence` - nth occurrence that is to be returned. 0 represents first one
      Returns:
        the CharSequence that is in between the given the nth (specified by occurrence) pair of `from` and `to` CharSequences and empty if the unavailable inputs are given.
      Since:
        3.0.0
      See Also:
        takeBetween(CharSequence,CharSequence,CharSequence)

    - #### public CharSequence takeBetween(CharSequence enclosure, int occurrence)

      Takes the characters between nth (specified by occurrence) pair of `enclosure` strings.

           def text = "t1='10' ms, t2='100' ms"

           assert text.takeBetween( "'", 0 ) == '10'
           assert text.takeBetween( "'", 1 ) == '100'
           assert text.takeBetween( "'", 2 ) == ''

      Parameters:
        `enclosure` - Enclosure CharSequence
        `occurrence` - nth occurrence being returned
      Returns:
        CharSequence between the nth occurrence of pair of `enclosure` strings
      Since:
        3.0.0
      See Also:
        takeBetween(CharSequence,CharSequence,int)

    - #### public CharSequence takeRight(int num)

      Returns the last `num` elements from this CharSequence.

           def text = "Groovy"
           assert text.takeRight( 0 ) == ''
           assert text.takeRight( 2 ) == 'vy'
           assert text.takeRight( 7 ) == 'Groovy'

      Parameters:
        `num` - the number of chars to take from this CharSequence from the right
      Returns:
        a CharSequence consisting of the last `num` chars, or else the whole CharSequence if it has less than `num` elements.
      Since:
        3.0.0

    - #### public String takeWhile(Closure condition)

      Returns the longest prefix of this CharSequence where each element passed to the given closure evaluates to true.

           def text = "Groovy"
           assert text.takeWhile{ it < 'A' } == ''
           assert text.takeWhile{ it < 'Z' } == 'G'
           assert text.takeWhile{ it != 'v' } == 'Groo'
           assert text.takeWhile{ it < 'z' } == 'Groovy'

      Parameters:
        `condition` - the closure that must evaluate to true to continue taking elements
      Returns:
        a prefix of elements in the CharSequence where each element passed to the given closure evaluates to true
      Since:
        2.0.0

    - #### public BigDecimal toBigDecimal()

      Parses a CharSequence into a BigDecimal

      Returns:
        a BigDecimal
      Since:
        1.8.2

    - #### public BigInteger toBigInteger()

      Parses a CharSequence into a BigInteger

      Returns:
        a BigInteger
      Since:
        1.8.2

    - #### public Number toCurrencyNumber(Locale locale)

      Parses a CharSequence into a Number using the currency format of the given locale. The result is an exact BigDecimal.

           assert '$1,234.50'.toCurrencyNumber(Locale.US) == 1234.50g

      No default-locale variant is provided. Input carries the locale of wherever it came from (a file, a request, a database), which is less often the JVM default than is the case for human-facing output. Where the default locale is a fair assumption, such as a console application reading what the user typed, pass Locale.getDefault explicitly.
      throws:
        NumberFormatException if the CharSequence cannot be parsed
      Parameters:
        `locale` - the locale defining the currency format
      Returns:
        the parsed Number (a BigDecimal)
      See Also:
        DefaultGroovyMethods#toCurrencyString(Number, Locale)#toCurrencyString(Number, Locale)
        NumberFormat.getCurrencyInstance
      Since:
        6.0.0

    - #### public Double toDouble()

      Parses a CharSequence into a Double.

      Returns:
        a Double
      Since:
        1.8.2

    - #### public Float toFloat()

      Parses a CharSequence into a Float.

      Returns:
        a Float
      Since:
        1.8.2

    - #### public Integer toInteger()

      Parses a CharSequence into an Integer.

      Returns:
        an Integer
      Since:
        1.8.2

    - #### public List<String> toList()

      Converts the given CharSequence into a List of Strings of one character.

      Returns:
        a List of characters (a 1-character String)
      Since:
        1.8.2

    - #### public Long toLong()

      Parses a CharSequence into a Long

      Returns:
        a Long
      Since:
        1.8.2

    - #### public Number toNumber(Locale locale)

      Parses a CharSequence into a Number using the given locale, honouring locale-specific grouping and decimal symbols. Like CharSequence.toBigDecimal, parsing is strict: the entire (trimmed) CharSequence must be a valid number, and the result is an exact BigDecimal.

           assert '1.234,5'.toNumber(Locale.GERMANY) == 1234.5

      There is no locale-aware formatting counterpart: use String.format, e.g. `String.format(Locale.GERMANY, '%,.3f', n)`. Note that unlike this method, such formatting rounds to the given number of fraction digits; Object.toString gives the exact, locale-free form.
      throws:
        NumberFormatException if the CharSequence cannot be parsed in full
      Parameters:
        `locale` - the locale defining the number symbols
      Returns:
        the parsed Number (a BigDecimal)
      See Also:
        toBigDecimal(CharSequence)
        String.format
        NumberFormat.getNumberInstance
      Since:
        6.0.0

    - #### public Number toPercentNumber(Locale locale)

      Parses a CharSequence into a Number using the percent format of the given locale. The percent value is unscaled (divided by 100). The result is an exact BigDecimal.

           assert '50%'.toPercentNumber(Locale.US) == 0.5

      No default-locale variant is provided. Input carries the locale of wherever it came from (a file, a request, a database), which is less often the JVM default than is the case for human-facing output. Where the default locale is a fair assumption, such as a console application reading what the user typed, pass Locale.getDefault explicitly.
      throws:
        NumberFormatException if the CharSequence cannot be parsed
      Parameters:
        `locale` - the locale defining the percent format
      Returns:
        the parsed Number (a BigDecimal)
      See Also:
        DefaultGroovyMethods#toPercentString(Number, Locale)#toPercentString(Number, Locale)
        NumberFormat.getPercentInstance
      Since:
        6.0.0

    - #### public Set<String> toSet()

      Converts the given CharSequence into a Set of unique Strings of one character.

      Returns:
        a Set of unique characters (each a 1-character String)
      Since:
        1.8.2

    - #### public Short toShort()

      Parses a CharSequence into a Short.

      Returns:
        a Short
      Since:
        1.8.2

    - #### public URI toURI()

      Transforms a CharSequence representing a URI into a URI object.

      throws:
        java.net.URISyntaxException is thrown if the URI is not well-formed.
      Returns:
        a URI
      Since:
        1.8.2

    - #### public URL toURL()

      Transforms a CharSequence representing a URL into a URL object.

      throws:
        java.net.MalformedURLException is thrown if the URL is not well-formed.
      Returns:
        a URL
      Since:
        1.8.2

    - #### public List<String> tokenize()

      Tokenizes a CharSequence (with a whitespace as the delimiter).

      Returns:
        a List of tokens
      Since:
        1.8.2
      See Also:
        StringTokenizer.StringTokenizer

    - #### public List<String> tokenize(Character delimiter)

      Tokenizes a CharSequence based on the given character delimiter.

      For example:

           char pathSep = ':'
           assert "/tmp:/usr".tokenize(pathSep) == ["/tmp", "/usr"]

      Parameters:
        `delimiter` - the delimiter
      Returns:
        a List of tokens
      Since:
        1.8.2
      See Also:
        StringTokenizer.StringTokenizer

    - #### public List<String> tokenize(CharSequence delimiters)

      Tokenizes a CharSequence based on the given CharSequence. Each character in the CharSequence is a separate delimiter.

      Parameters:
        `delimiters` - the delimiters
      Returns:
        a List of tokens
      Since:
        1.8.2
      See Also:
        StringTokenizer.StringTokenizer

    - #### public String tr(CharSequence sourceSet, CharSequence replacementSet)

      Translates a CharSequence by replacing characters from the sourceSet with characters from replacementSet. If the first character from sourceSet appears in the CharSequence, it will be replaced with the first character from replacementSet. If the second character from sourceSet appears in the CharSequence, it will be replaced with the second character from replacementSet. and so on for all provided replacement characters.

      Here is an example which converts the vowels in a word from lower to uppercase:

           assert 'hello'.tr('aeiou', 'AEIOU') == 'hEllO'

      A character range using regex-style syntax can also be used, e.g. here is an example which converts a word from lower to uppercase:

           assert 'hello'.tr('a-z', 'A-Z') == 'HELLO'

      Hyphens at the start or end of sourceSet or replacementSet are treated as normal hyphens and are not considered to be part of a range specification. Similarly, a hyphen immediately after an earlier range is treated as a normal hyphen. So, '-x', 'x-' have no ranges while 'a-c-e' has the range 'a-c' plus the '-' character plus the 'e' character.

      Unlike the unix tr command, Groovy's tr command supports reverse ranges, e.g.:

           assert 'hello'.tr('z-a', 'Z-A') == 'HELLO'

      If replacementSet is smaller than sourceSet, then the last character from replacementSet is used as the replacement for all remaining source characters as shown here:

           assert 'Hello World!'.tr('a-z', 'A') == 'HAAAA WAAAA!'

      If sourceSet contains repeated characters, the last specified replacement is used as shown here:

           assert 'Hello World!'.tr('lloo', '1234') == 'He224 W4r2d!'

      The functionality provided by tr can be achieved using regular expressions but tr provides a much more compact notation and efficient implementation for certain scenarios.
      Parameters:
        `sourceSet` - the set of characters to translate from
        `replacementSet` - the set of replacement characters
      Returns:
        The resulting translated `String`
      Since:
        1.8.2
      See Also:
        StringUtil.tr

    - #### public String uncapitalize()

      Convenience method to uncapitalize the first letter of a CharSequence (typically the first letter of a word). Example usage:

           assert 'H'.uncapitalize() == 'h'
           assert 'Hello'.uncapitalize() == 'hello'
           assert 'Hello world'.uncapitalize() == 'hello world'
           assert 'Hello World'.uncapitalize() == 'hello World'
           assert 'hello world' == 'Hello World'.split(' ').collect{ it.uncapitalize() }.join(' ')

      Returns:
        A String containing the uncapitalized toString() of the CharSequence
      Since:
        2.4.8

    - #### public String unexpand()

      Replaces sequences of whitespaces with tabs using tabStops of size 8.

      Returns:
        an unexpanded String
      Since:
        1.8.2

    - #### public String unexpand(int tabStop)

      Replaces sequences of whitespaces with tabs.

      Parameters:
        `tabStop` - The number of spaces a tab represents
      Returns:
        an unexpanded String
      Since:
        1.8.2

    - #### public String unexpandLine(int tabStop)

      Replaces sequences of whitespaces with tabs within a line.

      Parameters:
        `tabStop` - The number of spaces a tab represents
      Returns:
        an unexpanded String
      Since:
        1.8.2