org.codehaus.groovy.runtime

## Class StringGroovyMethods

- java.lang.Object
- - org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport
  - - org.codehaus.groovy.runtime.StringGroovyMethods

-     public class StringGroovyMethods
      extends DefaultGroovyMethodsSupport

  This class defines new groovy methods which appear on String-related JDK classes (String, CharSequence, Matcher) inside the Groovy environment. Static methods are used with the first parameter being the destination class, e.g.. `public static String reverse(String self)` provides a `reverse()` method for `String`.

  NOTE: While this class contains many 'public' static methods, it is primarily regarded as an internal class (its internal package name suggests this also). We value backwards compatibility of these methods when used within Groovy but value less backwards compatibility at the Java method call level. I.e. future versions of Groovy may remove or move a method call in this file but would normally aim to keep the method available from within Groovy.

  Author:
    James Strachan, Jeremy Rayner, Sam Pullara, Rod Cope, Guillaume Laforge, John Wilson, Hein Meling, Dierk Koenig, Pilho Kim, Marc Guillemot, Russel Winder, bing ran, Jochen Theodorou, Paul King, Michael Baehr, Joachim Baumann, Alex Tkachman, Ted Naleid, Brad Long, Jim Jagielski, Rodolfo Velasco, jeremi Joslin, Hamlet D'Arcy, Cedric Champeau, Tim Yates, Dinko Srkoc, Pascal Lombard, Christophe Charles

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StringGroovyMethods()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `asBoolean(CharSequence string)` Coerce a string (an instance of CharSequence) to a boolean value.
    `static boolean` | `asBoolean(Matcher matcher)` Coerce a Matcher instance to a boolean value.
    `static <T> T` | `asType(CharSequence self, Class<T> c)` Provides a method to perform custom 'dynamic' type conversion to the given class using the `as` operator.
    `static <T> T` | `asType(GString self, Class<T> c)` Converts the GString to a File, or delegates to the default `DefaultGroovyMethods.asType(Object, Class)`
    `static <T> T` | `asType(String self, Class<T> c)` Provides a method to perform custom 'dynamic' type conversion to the given class using the `as` operator.
    `static Pattern` | `bitwiseNegate(CharSequence self)` Turns a CharSequence into a regular expression Pattern
    `static Pattern` | `bitwiseNegate(String self)` Turns a String into a regular expression Pattern
    `static CharSequence` | `capitalize(CharSequence self)` Convenience method to capitalize the first letter of a CharSequence.
    `static String` | `capitalize(String self)` Convenience method to capitalize the first letter of a string (typically the first letter of a word).
    `static CharSequence` | `center(CharSequence self, Number numberOfChars)` Pad 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.
    `static CharSequence` | `center(CharSequence self, 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.
    `static String` | `center(String self, Number numberOfChars)` Pad a String to a minimum length specified by `numberOfChars` by adding the space character around it as many times as needed so that it remains centered.
    `static String` | `center(String self, Number numberOfChars, String padding)` Pad a String to a minimum length specified by `numberOfChars`, appending the supplied padding String around the original as many times as needed keeping it centered.
    `static String` | `collectReplacements(String orig, Closure<String> transform)` Iterate through this String a character at a time collecting either the original character or a transformed replacement String.
    `static boolean` | `contains(CharSequence self, CharSequence text)` Provide an implementation of contains() like `Collection.contains(Object)` to make CharSequences more polymorphic.
    `static boolean` | `contains(String self, String text)` Provide an implementation of contains() like `Collection.contains(Object)` to make Strings more polymorphic.
    `static int` | `count(CharSequence self, CharSequence text)` Count the number of occurrences of a sub CharSequence.
    `static int` | `count(String self, String text)` Count the number of occurrences of a substring.
    `static CharSequence` | `denormalize(CharSequence self)` Return a CharSequence with lines (separated by LF, CR/LF, or CR) terminated by the platform specific line separator.
    `static String` | `denormalize(String self)` Return a String with lines (separated by LF, CR/LF, or CR) terminated by the platform specific line separator.
    `static CharSequence` | `drop(CharSequence self, int num)` Drops the given number of chars from the head of this CharSequence if they are available.
    `static CharSequence` | `dropWhile(CharSequence self, Closure condition)` Create 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.
    `static <T> T` | `eachLine(CharSequence self, Closure<T> closure)` Iterates through this CharSequence line by line.
    `static <T> T` | `eachLine(CharSequence self, int firstLine, Closure<T> closure)` Iterates through this CharSequence line by line.
    `static <T> T` | `eachLine(String self, Closure<T> closure)` Iterates through this String line by line.
    `static <T> T` | `eachLine(String self, int firstLine, Closure<T> closure)` Iterates through this String line by line.
    `static String` | `eachMatch(CharSequence self, CharSequence regex, Closure closure)` Process each regex group matched substring of the given CharSequence.
    `static String` | `eachMatch(CharSequence self, Pattern pattern, Closure closure)` Process each regex group matched substring of the given pattern.
    `static String` | `eachMatch(String self, Pattern pattern, Closure closure)` Process each regex group matched substring of the given pattern.
    `static String` | `eachMatch(String self, String regex, Closure closure)` Process each regex group matched substring of the given string.
    `static CharSequence` | `expand(CharSequence self)` Expands all tabs into spaces with tabStops of size 8.
    `static CharSequence` | `expand(CharSequence self, int tabStop)` Expands all tabs into spaces.
    `static String` | `expand(String self)` Expands all tabs into spaces with tabStops of size 8.
    `static String` | `expand(String self, int tabStop)` Expands all tabs into spaces.
    `static CharSequence` | `expandLine(CharSequence self, int tabStop)` Expands all tabs into spaces.
    `static String` | `expandLine(String self, int tabStop)` Expands all tabs into spaces.
    `static CharSequence` | `find(CharSequence self, CharSequence regex)` Finds the first occurrence of a regular expression CharSequence within a CharSequence.
    `static CharSequence` | `find(CharSequence self, CharSequence regex, Closure closure)` Returns the result of calling a closure with the first occurrence of a regular expression found within a CharSequence.
    `static CharSequence` | `find(CharSequence self, Pattern pattern)` Finds the first occurrence of a compiled regular expression Pattern within a CharSequence.
    `static CharSequence` | `find(CharSequence self, Pattern pattern, 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.
    `static String` | `find(String self, Pattern pattern)` Finds the first occurrence of a compiled regular expression Pattern within a String.
    `static String` | `find(String self, Pattern pattern, Closure closure)` Returns the result of calling a closure with the first occurrence of a compiled regular expression found within a String.
    `static String` | `find(String self, String regex)` Finds the first occurrence of a regular expression String within a String.
    `static String` | `find(String self, String regex, Closure closure)` Returns the result of calling a closure with the first occurrence of a regular expression found within a String.
    `static List<CharSequence>` | `findAll(CharSequence self, CharSequence regex)` Returns a (possibly empty) list of all occurrences of a regular expression (in CharSequence format) found within a CharSequence.
    `static <T> List<T>` | `findAll(CharSequence self, CharSequence regex, Closure<T> closure)` Finds all occurrences of a capturing regular expression CharSequence within a CharSequence.
    `static List<CharSequence>` | `findAll(CharSequence self, Pattern pattern)` Returns a (possibly empty) list of all occurrences of a regular expression (in Pattern format) found within a CharSequence.
    `static <T> List<T>` | `findAll(CharSequence self, Pattern pattern, Closure<T> closure)` Finds all occurrences of a compiled regular expression Pattern within a CharSequence.
    `static List<String>` | `findAll(String self, Pattern pattern)` Returns a (possibly empty) list of all occurrences of a regular expression (in Pattern format) found within a String.
    `static <T> List<T>` | `findAll(String self, Pattern pattern, Closure<T> closure)` Finds all occurrences of a compiled regular expression Pattern within a String.
    `static List<String>` | `findAll(String self, String regex)` Returns a (possibly empty) list of all occurrences of a regular expression (in String format) found within a String.
    `static <T> List<T>` | `findAll(String self, String regex, Closure<T> closure)` Finds all occurrences of a regular expression string within a String.
    `static CharSequence` | `getAt(CharSequence self, Collection indices)` Select a List of characters from a CharSequence using a Collection to identify the indices to be selected.
    `static CharSequence` | `getAt(CharSequence text, EmptyRange range)` Support the range subscript operator for CharSequence or StringBuffer with EmptyRange
    `static CharSequence` | `getAt(CharSequence text, int index)` Support the subscript operator for CharSequence.
    `static CharSequence` | `getAt(CharSequence text, IntRange range)` Support the range subscript operator for CharSequence or StringBuffer with IntRange
    `static CharSequence` | `getAt(CharSequence text, Range range)` Support the range subscript operator for CharSequence
    `static List` | `getAt(Matcher self, Collection indices)` Select a List of values from a Matcher using a Collection to identify the indices to be selected.
    `static Object` | `getAt(Matcher matcher, int idx)` Support the subscript operator, e.g. matcher[index], for a regex Matcher.
    `static String` | `getAt(String self, Collection indices)` Select a List of characters from a String using a Collection to identify the indices to be selected.
    `static String` | `getAt(String text, EmptyRange range)` Support the range subscript operator for String with EmptyRange
    `static String` | `getAt(String text, int index)` Support the subscript operator for String.
    `static String` | `getAt(String text, IntRange range)` Support the range subscript operator for String with IntRange
    `static String` | `getAt(String text, Range range)` Support the range subscript operator for String
    `static char[]` | `getChars(CharSequence self)` Converts the given CharSequence into an array of characters.
    `static char[]` | `getChars(String self)` Converts the given String into an array of characters.
    `static int` | `getCount(Matcher matcher)` Find the number of Strings matched to the given Matcher.
    `static boolean` | `hasGroup(Matcher matcher)` Check whether a Matcher contains a group or not.
    `static boolean` | `isAllWhitespace(CharSequence self)` True if a CharSequence only contains whitespace characters.
    `static boolean` | `isAllWhitespace(String self)` True if a String only contains whitespace characters.
    `static boolean` | `isBigDecimal(CharSequence self)` Determine if a CharSequence can be parsed as a BigDecimal.
    `static boolean` | `isBigDecimal(String self)` Determine if a String can be parsed into a BigDecimal.
    `static boolean` | `isBigInteger(CharSequence self)` Determine if a CharSequence can be parsed as a BigInteger.
    `static boolean` | `isBigInteger(String self)` Determine if a String can be parsed into a BigInteger.
    `static boolean` | `isCase(CharSequence caseValue, Object switchValue)` 'Case' implementation for a CharSequence, which simply calls the equivalent method for String.
    `static boolean` | `isCase(GString caseValue, Object switchValue)` 'Case' implementation for a GString, which simply calls the equivalent method for String.
    `static boolean` | `isCase(Pattern caseValue, Object switchValue)` 'Case' implementation for the `Pattern` class, which allows testing a String against a number of regular expressions.
    `static boolean` | `isCase(String caseValue, Object switchValue)` 'Case' implementation for a String, which uses String#equals(Object) in order to allow Strings to be used in switch statements.
    `static boolean` | `isDouble(CharSequence self)` Determine if a CharSequence can be parsed as a Double.
    `static boolean` | `isDouble(String self)` Determine if a String can be parsed into a Double.
    `static boolean` | `isFloat(CharSequence self)` Determine if a CharSequence can be parsed as a Float.
    `static boolean` | `isFloat(String self)` Determine if a String can be parsed into a Float.
    `static boolean` | `isInteger(CharSequence self)` Determine if a CharSequence can be parsed as an Integer.
    `static boolean` | `isInteger(String self)` Determine if a String can be parsed into an Integer.
    `static boolean` | `isLong(CharSequence self)` Determine if a CharSequence can be parsed as a Long.
    `static boolean` | `isLong(String self)` Determine if a String can be parsed into a Long.
    `static boolean` | `isNumber(CharSequence self)` Determine if a CharSequence can be parsed as a Number.
    `static boolean` | `isNumber(String self)` Determine if a String can be parsed into a Number.
    `static Iterator` | `iterator(Matcher matcher)` Returns an `Iterator` which traverses each match.
    `static StringBuilder` | `leftShift(CharSequence self, Object value)` Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a CharSequence.
    `static StringBuffer` | `leftShift(StringBuffer self, Object value)` Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a StringBuffer.
    `static StringBuilder` | `leftShift(StringBuilder self, Object value)` Overloads the left shift operator to provide syntactic sugar for appending to a StringBuilder.
    `static StringBuffer` | `leftShift(String self, Object value)` Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a String.
    `static boolean` | `matches(CharSequence self, Pattern pattern)` Tells whether or not a CharSequence matches the given compiled regular expression Pattern.
    `static boolean` | `matches(String self, Pattern pattern)` Tells whether or not self matches the given compiled regular expression Pattern.
    `static boolean` | `matchesPartially(Matcher matcher)` Given a matcher that matches a string against a pattern, this method returns true when the string matches the pattern or if a longer string, could match the pattern.
    `static CharSequence` | `minus(CharSequence self, Object target)` Remove a part of a CharSequence by replacing the first occurrence of target within self with '' and returns the result.
    `static String` | `minus(String self, Object target)` Remove a part of a String.
    `static String` | `minus(String self, Pattern pattern)` Remove a part of a String.
    `static CharSequence` | `multiply(CharSequence self, Number factor)` Repeat a CharSequence a certain number of times.
    `static String` | `multiply(String self, Number factor)` Repeat a String a certain number of times.
    `static CharSequence` | `next(CharSequence self)` This method is called by the ++ operator for the class CharSequence.
    `static String` | `next(String self)` This method is called by the ++ operator for the class String.
    `static CharSequence` | `normalize(CharSequence self)` Return a CharSequence with linefeeds and carriage returns normalized to linefeeds.
    `static String` | `normalize(String self)` Return a String with linefeeds and carriage returns normalized to linefeeds.
    `static CharSequence` | `padLeft(CharSequence self, Number numberOfChars)` Pad a CharSequence to a minimum length specified by `numberOfChars` by adding the space character to the left as many times as needed.
    `static CharSequence` | `padLeft(CharSequence self, Number numberOfChars, CharSequence padding)` Pad a CharSequence to a minimum length specified by `numberOfChars`, adding the supplied padding CharSequence as many times as needed to the left.
    `static String` | `padLeft(String self, Number numberOfChars)` Pad a String to a minimum length specified by `numberOfChars` by adding the space character to the left as many times as needed.
    `static String` | `padLeft(String self, Number numberOfChars, String padding)` Pad a String to a minimum length specified by `numberOfChars`, adding the supplied padding String as many times as needed to the left.
    `static CharSequence` | `padRight(CharSequence self, Number numberOfChars)` Pad a CharSequence to a minimum length specified by `numberOfChars` by adding the space character to the right as many times as needed.
    `static CharSequence` | `padRight(CharSequence self, Number numberOfChars, CharSequence padding)` Pad a CharSequence to a minimum length specified by `numberOfChars`, adding the supplied padding CharSequence as many times as needed to the right.
    `static String` | `padRight(String self, Number numberOfChars)` Pad a String to a minimum length specified by `numberOfChars` by adding the space character to the right as many times as needed.
    `static String` | `padRight(String self, Number numberOfChars, String padding)` Pad a String to a minimum length specified by `numberOfChars`, adding the supplied padding String as many times as needed to the right.
    `static CharSequence` | `plus(CharSequence left, Object value)` Appends the String representation of the given operand to this string.
    `static String` | `plus(Number value, String right)` Appends a String to the string representation of this number.
    `static String` | `plus(StringBuffer left, String value)` Appends a String to this StringBuffer.
    `static String` | `plus(String left, CharSequence value)` Appends the String representation of the given operand to this string.
    `static String` | `plus(String left, Object value)` Appends the String representation of the given operand to this string.
    `static CharSequence` | `previous(CharSequence self)` This method is called by the -- operator for the class CharSequence.
    `static String` | `previous(String self)` This method is called by the -- operator for the class String.
    `static void` | `putAt(StringBuffer self, EmptyRange range, Object value)` Support the range subscript operator for StringBuffer.
    `static void` | `putAt(StringBuffer self, IntRange range, Object value)` Support the range subscript operator for StringBuffer.
    `static List<CharSequence>` | `readLines(CharSequence self)` Return the lines of a CharSequence as a List of CharSequence.
    `static List<String>` | `readLines(String self)` Return the lines of a String as a List of Strings.
    `static CharSequence` | `replaceAll(CharSequence self, CharSequence regex, CharSequence replacement)` Replaces each substring of this CharSequence that matches the given regular expression with the given replacement.
    `static CharSequence` | `replaceAll(CharSequence self, CharSequence regex, Closure closure)` Replaces all occurrences of a captured group by the result of a closure on that text.
    `static CharSequence` | `replaceAll(CharSequence self, Pattern pattern, CharSequence replacement)` Replaces all substrings of a CharSequence that match the given compiled regular expression with the given replacement.
    `static String` | `replaceAll(CharSequence self, Pattern pattern, Closure closure)` Replaces all occurrences of a captured group by the result of a closure call on that text.
    `static String` | `replaceAll(String self, Pattern pattern, Closure closure)` Replaces all occurrences of a captured group by the result of a closure call on that text.
    `static String` | `replaceAll(String self, Pattern pattern, String replacement)` Replaces all substrings of a String that match the given compiled regular expression with the given replacement.
    `static String` | `replaceAll(String self, String regex, Closure closure)` Replaces all occurrences of a captured group by the result of a closure on that text.
    `static String` | `replaceFirst(CharSequence self, CharSequence regex, CharSequence replacement)` Replaces the first substring of this CharSequence that matches the given regular expression with the given replacement.
    `static String` | `replaceFirst(CharSequence self, CharSequence regex, Closure closure)` Replaces the first occurrence of a captured group by the result of a closure call on that text.
    `static CharSequence` | `replaceFirst(CharSequence self, Pattern pattern, CharSequence replacement)` Replaces the first substring of a CharSequence that matches the given compiled regular expression with the given replacement.
    `static String` | `replaceFirst(CharSequence self, Pattern pattern, Closure closure)` Replaces the first occurrence of a captured group by the result of a closure call on that text.
    `static String` | `replaceFirst(String self, Pattern pattern, Closure closure)` Replaces the first occurrence of a captured group by the result of a closure call on that text.
    `static String` | `replaceFirst(String self, Pattern pattern, String replacement)` Replaces the first substring of a String that matches the given compiled regular expression with the given replacement.
    `static String` | `replaceFirst(String self, String regex, Closure closure)` Replaces the first occurrence of a captured group by the result of a closure call on that text.
    `static CharSequence` | `reverse(CharSequence self)` Creates a new CharSequence which is the reverse (backwards) of this string
    `static String` | `reverse(String self)` Creates a new string which is the reverse (backwards) of this string
    `static void` | `setIndex(Matcher matcher, int idx)` Set the position of the given Matcher to the given index.
    `static int` | `size(CharSequence text)` Provide the standard Groovy `size()` method for `CharSequence`.
    `static long` | `size(Matcher self)` Provide the standard Groovy `size()` method for `Matcher`.
    `static int` | `size(String text)` Provide the standard Groovy `size()` method for `String`.
    `static int` | `size(StringBuffer buffer)` Provide the standard Groovy `size()` method for `StringBuffer`.
    `static CharSequence[]` | `split(CharSequence self)` Convenience method to split a CharSequence (with whitespace as delimiter).
    `static String[]` | `split(GString self)` Convenience method to split a GString (with whitespace as delimiter).
    `static String[]` | `split(String self)` Convenience method to split a string (with whitespace as delimiter) Like tokenize, but returns an Array of Strings instead of a List
    `static <T> T` | `splitEachLine(CharSequence self, CharSequence regex, Closure<T> closure)` Iterates through the given CharSequence line by line, splitting each line using the given separator.
    `static <T> T` | `splitEachLine(CharSequence self, Pattern pattern, Closure<T> closure)` Iterates through the given CharSequence line by line, splitting each line using the given separator Pattern.
    `static <T> T` | `splitEachLine(String self, Pattern pattern, Closure<T> closure)` Iterates through the given String line by line, splitting each line using the given separator Pattern.
    `static <T> T` | `splitEachLine(String self, String regex, Closure<T> closure)` Iterates through the given String line by line, splitting each line using the given separator.
    `static CharSequence` | `stripIndent(CharSequence self)` Strip leading spaces from every line in a CharSequence.
    `static CharSequence` | `stripIndent(CharSequence self, int numChars)` Strip `numChar` leading characters from every line in a CharSequence.
    `static String` | `stripIndent(String self)` Strip leading spaces from every line in a String.
    `static String` | `stripIndent(String self, int numChars)` Strip `numChar` leading characters from every line in a String.
    `static CharSequence` | `stripMargin(CharSequence self)` Strip leading whitespace/control characters followed by '|' from every line in a CharSequence.
    `static CharSequence` | `stripMargin(CharSequence self, char marginChar)` Strip leading whitespace/control characters followed by `marginChar` from every line in a String.
    `static String` | `stripMargin(CharSequence self, CharSequence marginChar)` Strip leading whitespace/control characters followed by `marginChar` from every line in a CharSequence.
    `static String` | `stripMargin(String self)` Strip leading whitespace/control characters followed by '|' from every line in a String.
    `static String` | `stripMargin(String self, char marginChar)` Strip leading whitespace/control characters followed by `marginChar` from every line in a String.
    `static String` | `stripMargin(String self, String marginChar)` Strip leading whitespace/control characters followed by `marginChar` from every line in a String.
    `static CharSequence` | `take(CharSequence self, int num)` Returns the first `num` elements from this CharSequence.
    `static CharSequence` | `takeWhile(CharSequence self, Closure condition)` Returns the longest prefix of this CharSequence where each element passed to the given closure evaluates to true.
    `static BigDecimal` | `toBigDecimal(CharSequence self)` Parse a CharSequence into a BigDecimal
    `static BigDecimal` | `toBigDecimal(String self)` Parse a String into a BigDecimal
    `static BigInteger` | `toBigInteger(CharSequence self)` Parse a CharSequence into a BigInteger
    `static BigInteger` | `toBigInteger(String self)` Parse a String into a BigInteger
    `static Boolean` | `toBoolean(String self)` Converts the given string into a Boolean object.
    `static Character` | `toCharacter(String self)` Converts the given string into a Character object using the first character in the string.
    `static Double` | `toDouble(CharSequence self)` Parse a CharSequence into a Double
    `static Double` | `toDouble(String self)` Parse a String into a Double
    `static Float` | `toFloat(CharSequence self)` Parse a CharSequence into a Float
    `static Float` | `toFloat(String self)` Parse a String into a Float
    `static Integer` | `toInteger(CharSequence self)` Parse a CharSequence into an Integer
    `static Integer` | `toInteger(String self)` Parse a String into an Integer
    `static List<CharSequence>` | `tokenize(CharSequence self)` Tokenize a CharSequence (with a whitespace as the delimiter).
    `static List<CharSequence>` | `tokenize(CharSequence self, Character token)` Tokenize a CharSequence based on the given character delimiter.
    `static List<CharSequence>` | `tokenize(CharSequence self, CharSequence token)` Tokenize a CharSequence based on the given CharSequence delimiter.
    `static List<String>` | `tokenize(String self)` Tokenize a String (with a whitespace as the delimiter).
    `static List<String>` | `tokenize(String self, Character token)` Tokenize a String based on the given character delimiter.
    `static List<String>` | `tokenize(String self, String token)` Tokenize a String based on the given string delimiter.
    `static List<CharSequence>` | `toList(CharSequence self)` Converts the given CharSequence into a List of CharSequence of one character.
    `static List<String>` | `toList(String self)` Converts the given String into a List of strings of one character.
    `static Long` | `toLong(CharSequence self)` Parse a CharSequence into a Long
    `static Long` | `toLong(String self)` Parse a String into a Long
    `static Set<CharSequence>` | `toSet(CharSequence self)` Converts the given CharSequence into a Set of unique CharSequence of one character.
    `static Set<String>` | `toSet(String self)` Converts the given String into a Set of unique strings of one character.
    `static Short` | `toShort(CharSequence self)` Parse a CharSequence into a Short
    `static Short` | `toShort(String self)` Parse a String into a Short
    `static CharSequence` | `tr(CharSequence self, CharSequence sourceSet, CharSequence replacementSet)` Translates a string by replacing characters from the sourceSet with characters from replacementSet.
    `static String` | `tr(String self, String sourceSet, String replacementSet)` Translates a string by replacing characters from the sourceSet with characters from replacementSet.
    `static CharSequence` | `unexpand(CharSequence self)` Replaces sequences of whitespaces with tabs using tabStops of size 8.
    `static CharSequence` | `unexpand(CharSequence self, int tabStop)` Replaces sequences of whitespaces with tabs.
    `static String` | `unexpand(String self)` Replaces sequences of whitespaces with tabs using tabStops of size 8.
    `static String` | `unexpand(String self, int tabStop)` Replaces sequences of whitespaces with tabs.
    `static CharSequence` | `unexpandLine(CharSequence self, int tabStop)` Replaces sequences of whitespaces with tabs within a line.
    `static String` | `unexpandLine(String self, int tabStop)` Replaces sequences of whitespaces with tabs within a line.

    - ### Methods inherited from class org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport

      `cloneSimilarCollection, cloneSimilarMap, closeQuietly, closeWithWarning, createSimilarArray, createSimilarCollection, createSimilarCollection, createSimilarList, createSimilarMap, createSimilarOrDefaultCollection, createSimilarSet, normaliseIndex, sameType, subListBorders, subListBorders`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StringGroovyMethods

          public StringGroovyMethods()

  - ### Method Detail

    - #### asBoolean

          public static boolean asBoolean(CharSequence string)

      Coerce a string (an instance of CharSequence) to a boolean value. A string is coerced to false if it is of length 0, and to true otherwise.
      Parameters:
        `string` - the character sequence
      Returns:
        the boolean value
      Since:
        1.7.0

    - #### asBoolean

          public static boolean asBoolean(Matcher matcher)

      Coerce a Matcher instance to a boolean value.
      Parameters:
        `matcher` - the matcher
      Returns:
        the boolean value
      Since:
        1.7.0

    - #### asType

          public static <T> T asType(CharSequence self,
                     Class<T> c)

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

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

    - #### asType

          public static <T> T asType(GString self,
                     Class<T> c)

      Converts the GString to a File, or delegates to the default `DefaultGroovyMethods.asType(Object, Class)`
      Parameters:
        `self` - a GString
        `c` - the desired class
      Returns:
        the converted object
      Since:
        1.5.0

    - #### asType

          public static <T> T asType(String self,
                     Class<T> c)

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

      By default, the following types are supported:

      - List
      - BigDecimal
      - BigInteger
      - Long
      - Integer
      - Short
      - Byte
      - Character
      - Double
      - Float
      - File
      - Subclasses of Enum (Java 5 and above)
      If any other type is given, the call is delegated to `DefaultGroovyMethods.asType(Object, Class)`.
      Parameters:
        `self` - a String
        `c` - the desired class
      Returns:
        the converted object
      Since:
        1.0

    - #### bitwiseNegate

          public static Pattern bitwiseNegate(CharSequence self)

      Turns a CharSequence into a regular expression Pattern
      Parameters:
        `self` - a String to convert into a regular expression
      Returns:
        the regular expression pattern
      Since:
        1.8.2

    - #### bitwiseNegate

          public static Pattern bitwiseNegate(String self)

      Turns a String into a regular expression Pattern
      Parameters:
        `self` - a String to convert into a regular expression
      Returns:
        the regular expression pattern
      Since:
        1.5.0

    - #### capitalize

          public static CharSequence capitalize(CharSequence self)

      Convenience method to capitalize the first letter of a CharSequence.
      Parameters:
        `self` - The CharSequence to capitalize
      Returns:
        The capitalized CharSequence
      Since:
        1.8.2
      See Also:
        `capitalize(String)`

    - #### capitalize

          public static String capitalize(String self)

      Convenience method to capitalize the first letter of a string (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(' ')

      Parameters:
        `self` - The string to capitalize
      Returns:
        The capitalized String
      Since:
        1.7.3

    - #### center

          public static CharSequence center(CharSequence self,
                            Number numberOfChars)

      Pad 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.
      Parameters:
        `self` - a CharSequence object
        `numberOfChars` - the total minimum number of characters of the resulting CharSequence
      Returns:
        the CharSequence centered with padded characters around it
      Since:
        1.8.2
      See Also:
        `center(String, Number)`

    - #### center

          public static CharSequence center(CharSequence self,
                            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.
      Parameters:
        `self` - a CharSequence object
        `numberOfChars` - the total minimum number of characters of the resulting CharSequence
        `padding` - the characters used for padding
      Returns:
        the CharSequence centered with padded characters around it
      Since:
        1.8.2
      See Also:
        `center(String, Number, String)`

    - #### center

          public static String center(String self,
                      Number numberOfChars)

      Pad a String 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:
        `self` - a String object
        `numberOfChars` - the total minimum number of characters of the resulting string
      Returns:
        the String centered with padded characters around it
      Since:
        1.0
      See Also:
        `center(String, Number, String)`

    - #### center

          public static String center(String self,
                      Number numberOfChars,
                      String padding)

      Pad a String to a minimum length specified by `numberOfChars`, appending the supplied padding String 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:
        `self` - a String object
        `numberOfChars` - the total minimum number of characters of the resulting string
        `padding` - the characters used for padding
      Returns:
        the String centered with padded characters around it
      Since:
        1.0

    - #### contains

          public static boolean contains(CharSequence self,
                         CharSequence text)

      Provide an implementation of contains() like `Collection.contains(Object)` to make CharSequences more polymorphic.
      Parameters:
        `self` - a CharSequence
        `text` - the CharSequence to look for
      Returns:
        true if this CharSequence contains the given text
      Since:
        1.8.2
      See Also:
        `contains(String, String)`

    - #### contains

          public static boolean contains(String self,
                         String text)

      Provide an implementation of contains() like `Collection.contains(Object)` to make Strings more polymorphic. This method is not required on JDK 1.5 onwards
      Parameters:
        `self` - a String
        `text` - a String to look for
      Returns:
        true if this string contains the given text
      Since:
        1.0

    - #### count

          public static int count(CharSequence self,
                  CharSequence text)

      Count the number of occurrences of a sub CharSequence.
      Parameters:
        `self` - a CharSequence
        `text` - a sub CharSequence
      Returns:
        the number of occurrences of the given CharSequence inside this CharSequence
      Since:
        1.8.2
      See Also:
        `count(String, String)`

    - #### count

          public static int count(String self,
                  String text)

      Count the number of occurrences of a substring.
      Parameters:
        `self` - a String
        `text` - a substring
      Returns:
        the number of occurrences of the given string inside this String
      Since:
        1.0

    - #### denormalize

          public static CharSequence denormalize(CharSequence self)

      Return a CharSequence with lines (separated by LF, CR/LF, or CR) terminated by the platform specific line separator.
      Parameters:
        `self` - a CharSequence object
      Returns:
        the denormalized CharSequence
      Since:
        1.8.2
      See Also:
        `denormalize(String)`

    - #### denormalize

          public static String denormalize(String self)

      Return a String with lines (separated by LF, CR/LF, or CR) terminated by the platform specific line separator.
      Parameters:
        `self` - a String object
      Returns:
        the denormalized string
      Since:
        1.6.0

    - #### drop

          public static CharSequence drop(CharSequence self,
                          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:
        `self` - the original CharSequence
        `num` - the number of characters to drop from this iterator
      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

    - #### dropWhile

          public static CharSequence dropWhile(CharSequence self,
                               Closure condition)

      Create 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:
        `self` - the original CharSequence
        `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

    - #### eachLine

          public static <T> T eachLine(CharSequence self,
                       Closure<T> closure)
                            throws IOException

      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.
      Parameters:
        `self` - a CharSequence
        `closure` - a closure
      Returns:
        the last value returned by the closure
      Throws:
        `IOException` - if an error occurs
      Since:
        1.8.2
      See Also:
        `eachLine(String, groovy.lang.Closure)`

    - #### eachLine

          public static <T> T eachLine(CharSequence self,
                       int firstLine,
                       Closure<T> closure)
                            throws IOException

      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.
      Parameters:
        `self` - a CharSequence
        `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
      Throws:
        `IOException` - if an error occurs
      Since:
        1.8.2
      See Also:
        `eachLine(String, int, groovy.lang.Closure)`

    - #### eachLine

          public static <T> T eachLine(String self,
                       Closure<T> closure)
                            throws IOException

      Iterates through this String 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.
      Parameters:
        `self` - a String
        `closure` - a closure
      Returns:
        the last value returned by the closure
      Throws:
        `IOException` - if an error occurs
      Since:
        1.5.5
      See Also:
        `eachLine(String, int, groovy.lang.Closure)`

    - #### eachLine

          public static <T> T eachLine(String self,
                       int firstLine,
                       Closure<T> closure)
                            throws IOException

      Iterates through this String 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.
      Parameters:
        `self` - a String
        `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
      Throws:
        `IOException` - if an error occurs
      Since:
        1.5.7

    - #### collectReplacements

          public static String collectReplacements(String orig,
                                   Closure<String> transform)

      Iterate through this String a character at a time collecting either the original character or a transformed replacement String. The `transform` Closure should return `null` to indicate that no transformation is required for the given character.

           assert "Groovy".collectReplacements{ it == 'o' ? '_O_' : null } == 'Gr_O__O_vy'
           assert "B&W".collectReplacements{ it == '&' ? '&' : null } == 'B&W'

      Parameters:
        `orig` - the original String
      Returns:
        A new string in which all characters that require escaping have been replaced with the corresponding replacements as determined by the `transform` Closure.

    - #### eachMatch

          public static String eachMatch(CharSequence self,
                         CharSequence regex,
                         Closure closure)

      Process each regex group matched substring of the given CharSequence. If the closure parameter takes one argument, an array with all match groups is passed to it. If the closure takes as many arguments as there are match groups, then each parameter will be one match group.
      Parameters:
        `self` - the source CharSequence
        `regex` - a Regex CharSequence
        `closure` - a closure with one parameter or as much parameters as groups
      Returns:
        the source CharSequence
      Since:
        1.8.2
      See Also:
        `eachMatch(String, String, groovy.lang.Closure)`

    - #### eachMatch

          public static String eachMatch(CharSequence self,
                         Pattern pattern,
                         Closure closure)

      Process each regex group matched substring of the given pattern. If the closure parameter takes one argument, an array with all match groups is passed to it. If the closure takes as many arguments as there are match groups, then each parameter will be one match group.
      Parameters:
        `self` - the source CharSequence
        `pattern` - a regex Pattern
        `closure` - a closure with one parameter or as much parameters as groups
      Returns:
        the source CharSequence
      Since:
        1.8.2
      See Also:
        `eachMatch(String, java.util.regex.Pattern, groovy.lang.Closure)`

    - #### eachMatch

          public static String eachMatch(String self,
                         Pattern pattern,
                         Closure closure)

      Process each regex group matched substring of the given pattern. If the closure parameter takes one argument, an array with all match groups is passed to it. If the closure takes as many arguments as there are match groups, then each parameter will be one match group.
      Parameters:
        `self` - the source string
        `pattern` - a regex Pattern
        `closure` - a closure with one parameter or as much parameters as groups
      Returns:
        the source string
      Since:
        1.6.1

    - #### eachMatch

          public static String eachMatch(String self,
                         String regex,
                         Closure closure)

      Process each regex group matched substring of the given string. If the closure parameter takes one argument, an array with all match groups is passed to it. If the closure takes as many arguments as there are match groups, then each parameter will be one match group.
      Parameters:
        `self` - the source string
        `regex` - a Regex string
        `closure` - a closure with one parameter or as much parameters as groups
      Returns:
        the source string
      Since:
        1.6.0

    - #### expand

          public static CharSequence expand(CharSequence self)

      Expands all tabs into spaces with tabStops of size 8.
      Parameters:
        `self` - A CharSequence to expand
      Returns:
        The expanded CharSequence
      Since:
        1.8.2
      See Also:
        `expand(String)`

    - #### expand

          public static CharSequence expand(CharSequence self,
                            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:
        `self` - A CharSequence to expand
        `tabStop` - The number of spaces a tab represents
      Returns:
        The expanded CharSequence
      Since:
        1.8.2
      See Also:
        `expand(String, int)`

    - #### expand

          public static String expand(String self)

      Expands all tabs into spaces with tabStops of size 8.
      Parameters:
        `self` - A String to expand
      Returns:
        The expanded String
      Since:
        1.7.3
      See Also:
        `expand(String, int)`

    - #### expand

          public static String expand(String self,
                      int tabStop)

      Expands all tabs into spaces. If the String has multiple lines, expand each line - restarting tab stops at the start of each line.
      Parameters:
        `self` - A String to expand
        `tabStop` - The number of spaces a tab represents
      Returns:
        The expanded String
      Since:
        1.7.3

    - #### expandLine

          public static CharSequence expandLine(CharSequence self,
                                int tabStop)

      Expands all tabs into spaces. Assumes the CharSequence represents a single line of text.
      Parameters:
        `self` - A line to expand
        `tabStop` - The number of spaces a tab represents
      Returns:
        The expanded CharSequence
      Since:
        1.8.2
      See Also:
        `expandLine(String, int)`

    - #### expandLine

          public static String expandLine(String self,
                          int tabStop)

      Expands all tabs into spaces. Assumes the String represents a single line of text.
      Parameters:
        `self` - A line to expand
        `tabStop` - The number of spaces a tab represents
      Returns:
        The expanded String
      Since:
        1.7.3

    - #### find

          public static CharSequence find(CharSequence self,
                          CharSequence regex)

      Finds the first occurrence of a regular expression CharSequence within a CharSequence.
      Parameters:
        `self` - a CharSequence
        `regex` - the capturing regex
      Returns:
        a CharSequence containing the matched portion, or null if the regex doesn't match
      Since:
        1.8.2
      See Also:
        `find(String, java.util.regex.Pattern)`

    - #### find

          public static CharSequence find(CharSequence self,
                          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:
        `self` - a CharSequence
        `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 CharSequence 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(String, java.util.regex.Pattern, groovy.lang.Closure)`

    - #### find

          public static CharSequence find(CharSequence self,
                          Pattern pattern)

      Finds the first occurrence of a compiled regular expression Pattern within a CharSequence.
      Parameters:
        `self` - a CharSequence
        `pattern` - the compiled regex Pattern
      Returns:
        a CharSequence containing the matched portion, or null if the regex pattern doesn't match
      Since:
        1.8.2
      See Also:
        `find(String, java.util.regex.Pattern)`

    - #### find

          public static CharSequence find(CharSequence self,
                          Pattern pattern,
                          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:
        `self` - a CharSequence
        `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 CharSequence 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(String, java.util.regex.Pattern, groovy.lang.Closure)`

    - #### find

          public static String find(String self,
                    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 null == "New York, NY".find(~/\d{5}/)

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

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

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

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

      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:
        `self` - a String
        `pattern` - the compiled regex Pattern
      Returns:
        a String containing the matched portion, or null if the regex pattern doesn't match
      Since:
        1.6.1

    - #### find

          public static String find(String self,
                    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 null == "New York, NY".find(~/\d{5}/) { match -> return "-$match-"}

      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 "-10292-" == "New York, NY 10292-0098".find(~/\d{5}/) { match -> return "-$match-"}

      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 "10292" == "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
                }

      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 "10292" == "New York, NY 10292-0098".find(~/(\d{5})-?(\d{4})/) { match, zip, plusFour ->
                    assert array[0] == "10292-0098"
                    assert array[1] == "10292"
                    assert array[2] == "0098"
                    return array[1]
                }

      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 "2339999" == "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"
                }

      Parameters:
        `self` - a String
        `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.6.1

    - #### find

          public static String find(String self,
                    String 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 null == "New York, NY".find(/\d{5}/)

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

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

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

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

      Parameters:
        `self` - a String
        `regex` - the capturing regex
      Returns:
        a String containing the matched portion, or null if the regex doesn't match
      Since:
        1.6.1

    - #### find

          public static String find(String self,
                    String regex,
                    Closure closure)

      Returns the result of calling a closure with the first occurrence of a 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 regex doesn't match, the result is null:

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

      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 "-10292-" == "New York, NY 10292-0098".find(~/\d{5}/) { match -> return "-$match-"}

      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 "10292" == "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
                }

      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 "10292" == "New York, NY 10292-0098".find(~/(\d{5})-?(\d{4})/) { match, zip, plusFour ->
                    assert array[0] == "10292-0098"
                    assert array[1] == "10292"
                    assert array[2] == "0098"
                    return array[1]
                }

      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 "2339999" == "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"
                }

      Parameters:
        `self` - a String
        `regex` - the capturing regex string
        `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 the closure (calling toString() if needed), or null if the regex pattern doesn't match
      Since:
        1.6.1

    - #### findAll

          public static List<CharSequence> findAll(CharSequence self,
                                   CharSequence regex)

      Returns a (possibly empty) list of all occurrences of a regular expression (in CharSequence format) found within a CharSequence.
      Parameters:
        `self` - a CharSequence
        `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(String, String)`

    - #### findAll

          public static <T> List<T> findAll(CharSequence self,
                            CharSequence regex,
                            Closure<T> closure)

      Finds all occurrences of a capturing regular expression CharSequence within a CharSequence.
      Parameters:
        `self` - a CharSequence
        `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(String, String, groovy.lang.Closure)`

    - #### findAll

          public static List<CharSequence> findAll(CharSequence self,
                                   Pattern pattern)

      Returns a (possibly empty) list of all occurrences of a regular expression (in Pattern format) found within a CharSequence.
      Parameters:
        `self` - a CharSequence
        `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
      See Also:
        `findAll(String, java.util.regex.Pattern)`

    - #### findAll

          public static <T> List<T> findAll(CharSequence self,
                            Pattern pattern,
                            Closure<T> closure)

      Finds all occurrences of a compiled regular expression Pattern within a CharSequence.
      Parameters:
        `self` - a CharSequence
        `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
      See Also:
        `findAll(String, java.util.regex.Pattern, groovy.lang.Closure)`

    - #### findAll

          public static List<String> findAll(String self,
                             Pattern pattern)

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

      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 expected == "One Fish, Two Fish, Red Fish, Blue Fish".findAll(~/(\w*) Fish/)

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

    - #### findAll

          public static <T> List<T> findAll(String self,
                            Pattern pattern,
                            Closure<T> closure)

      Finds all occurrences of a compiled regular expression Pattern within a String. 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 ["couldn't", "wouldn't"] == "I could not, would not, with a fox.".findAll(~/.ould/) { match -> "${match}n'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 ["W > Wocket", "P > Pocket"] == orig.findAll(~/(.)ocket/) { match, firstLetter -> "$firstLetter > $match" }

      Parameters:
        `self` - a String
        `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 String, an empty list will be returned if there are no matches
      Since:
        1.6.1

    - #### findAll

          public static List<String> findAll(String self,
                             String regex)

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

      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 expected == "One Fish, Two Fish, Red Fish, Blue Fish".findAll(/(\w*) Fish/)

      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:
        `self` - a String
        `regex` - the capturing regex String
      Returns:
        a List containing all full matches of the regex within the string, an empty list will be returned if there are no matches
      Since:
        1.6.1

    - #### findAll

          public static <T> List<T> findAll(String self,
                            String regex,
                            Closure<T> closure)

      Finds all occurrences of a regular expression string within a String. 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 ["couldn't", "wouldn't"] == "I could not, would not, with a fox.".findAll(/.ould/) { match -> "${match}n'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 ["W > Wocket", "P > Pocket"] == orig.findAll(/(.)ocket/) { match, firstLetter -> "$firstLetter > $match" }

      Parameters:
        `self` - a String
        `regex` - the capturing regex String
        `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 String, an empty list will be returned if there are no matches
      Since:
        1.6.1

    - #### getAt

          public static CharSequence getAt(CharSequence self,
                           Collection indices)

      Select a List of characters from a CharSequence using a Collection to identify the indices to be selected.
      Parameters:
        `self` - a CharSequence
        `indices` - a Collection of indices
      Returns:
        a CharSequence consisting of the characters at the given indices
      Since:
        1.0

    - #### getAt

          public static CharSequence getAt(CharSequence text,
                           EmptyRange range)

      Support the range subscript operator for CharSequence or StringBuffer with EmptyRange
      Parameters:
        `text` - a CharSequence
        `range` - an EmptyRange
      Returns:
        the subsequence CharSequence
      Since:
        1.5.0

    - #### getAt

          public static CharSequence getAt(CharSequence text,
                           int index)

      Support the subscript operator for CharSequence.
      Parameters:
        `text` - a CharSequence
        `index` - the index of the Character to get
      Returns:
        the Character at the given index
      Since:
        1.0

    - #### getAt

          public static CharSequence getAt(CharSequence text,
                           IntRange range)

      Support the range subscript operator for CharSequence or StringBuffer with IntRange
      Parameters:
        `text` - a CharSequence
        `range` - an IntRange
      Returns:
        the subsequence CharSequence
      Since:
        1.0

    - #### getAt

          public static CharSequence getAt(CharSequence text,
                           Range range)

      Support the range subscript operator for CharSequence
      Parameters:
        `text` - a CharSequence
        `range` - a Range
      Returns:
        the subsequence CharSequence
      Since:
        1.0

    - #### getAt

          public static List getAt(Matcher self,
                   Collection indices)

      Select a List of values from a Matcher using a Collection to identify the indices to be selected.
      Parameters:
        `self` - a Matcher
        `indices` - a Collection of indices
      Returns:
        a String of the values at the given indices
      Since:
        1.6.0

    - #### getAt

          public static Object getAt(Matcher matcher,
                     int idx)

      Support the subscript operator, e.g. matcher[index], for a regex Matcher.

      For an example using no group match,

              def p = /ab[d|f]/
              def m = "abcabdabeabf" =~ p
              assert 2 == m.count
              assert 2 == m.size() // synonym for m.getCount()
              assert ! m.hasGroup()
              assert 0 == m.groupCount()
              def matches = ["abd", "abf"]
              for (i in 0..<m.count) {
                assert m[i] == matches[i]
              }

      For an example using group matches,

              def p = /(?:ab([c|d|e|f]))/
              def m = "abcabdabeabf" =~ p
              assert 4 == m.count
              assert m.hasGroup()
              assert 1 == m.groupCount()
              def matches = [["abc", "c"], ["abd", "d"], ["abe", "e"], ["abf", "f"]]
              for (i in 0..<m.count) {
                assert m[i] == matches[i]
              }

      For another example using group matches,

              def m = "abcabdabeabfabxyzabx" =~ /(?:ab([d|x-z]+))/
              assert 3 == m.count
              assert m.hasGroup()
              assert 1 == m.groupCount()
              def matches = [["abd", "d"], ["abxyz", "xyz"], ["abx", "x"]]
              for (i in 0..<m.count) {
                assert m[i] == matches[i]
              }

      Parameters:
        `matcher` - a Matcher
        `idx` - an index
      Returns:
        object a matched String if no groups matched, list of matched groups otherwise.
      Since:
        1.0

    - #### matchesPartially

          public static boolean matchesPartially(Matcher matcher)

      Given a matcher that matches a string against a pattern, this method returns true when the string matches the pattern or if a longer string, could match the pattern. For example:

               def emailPattern = /\w+@\w+\.\w{2,}/

               def matcher = "john@doe" =~ emailPattern
               assert matcher.matchesPartially()

               matcher = "john@doe.com" =~ emailPattern
               assert matcher.matchesPartially()

               matcher = "john@@" =~ emailPattern
               assert !matcher.matchesPartially()

      Parameters:
        `matcher` - the Matcher
      Returns:
        true if more input to the String could make the matcher match the associated pattern, false otherwise.
      Since:
        2.0.0

    - #### getAt

          public static String getAt(String self,
                     Collection indices)

      Select a List of characters from a String using a Collection to identify the indices to be selected.
      Parameters:
        `self` - a String
        `indices` - a Collection of indices
      Returns:
        a String consisting of the characters at the given indices
      Since:
        1.0

    - #### getAt

          public static String getAt(String text,
                     EmptyRange range)

      Support the range subscript operator for String with EmptyRange
      Parameters:
        `text` - a String
        `range` - an EmptyRange
      Returns:
        the resulting String
      Since:
        1.5.0

    - #### getAt

          public static String getAt(String text,
                     int index)

      Support the subscript operator for String.
      Parameters:
        `text` - a String
        `index` - the index of the Character to get
      Returns:
        the Character at the given index
      Since:
        1.0

    - #### getAt

          public static String getAt(String text,
                     IntRange range)

      Support the range subscript operator for String with IntRange
      Parameters:
        `text` - a String
        `range` - an IntRange
      Returns:
        the resulting String
      Since:
        1.0

    - #### getAt

          public static String getAt(String text,
                     Range range)

      Support the range subscript operator for String
      Parameters:
        `text` - a String
        `range` - a Range
      Returns:
        a substring corresponding to the Range
      Since:
        1.0

    - #### getChars

          public static char[] getChars(CharSequence self)

      Converts the given CharSequence into an array of characters.
      Parameters:
        `self` - a CharSequence
      Returns:
        an array of characters
      Since:
        1.8.2
      See Also:
        `getChars(String)`

    - #### getChars

          public static char[] getChars(String self)

      Converts the given String into an array of characters. Alias for toCharArray.
      Parameters:
        `self` - a String
      Returns:
        an array of characters
      Since:
        1.6.0
      See Also:
        `String.toCharArray()`

    - #### getCount

          public static int getCount(Matcher matcher)

      Find the number of Strings matched to the given Matcher.
      Parameters:
        `matcher` - a Matcher
      Returns:
        int the number of Strings matched to the given matcher.
      Since:
        1.0

    - #### hasGroup

          public static boolean hasGroup(Matcher matcher)

      Check whether a Matcher contains a group or not.
      Parameters:
        `matcher` - a Matcher
      Returns:
        boolean `true` if matcher contains at least one group.
      Since:
        1.0

    - #### isAllWhitespace

          public static boolean isAllWhitespace(CharSequence self)

      True if a CharSequence only contains whitespace characters.
      Parameters:
        `self` - The CharSequence to check the characters in
      Returns:
        true If all characters are whitespace characters
      Since:
        1.8.2
      See Also:
        `isAllWhitespace(String)`

    - #### isAllWhitespace

          public static boolean isAllWhitespace(String self)

      True if a String only contains whitespace characters.
      Parameters:
        `self` - The String to check the characters in
      Returns:
        true If all characters are whitespace characters
      Since:
        1.6
      See Also:
        `Character.isWhitespace(char)`

    - #### isBigDecimal

          public static boolean isBigDecimal(CharSequence self)

      Determine if a CharSequence can be parsed as a BigDecimal.
      Parameters:
        `self` - a CharSequence
      Returns:
        true if the CharSequence can be parsed
      Since:
        1.8.2
      See Also:
        `isBigDecimal(String)`

    - #### isBigDecimal

          public static boolean isBigDecimal(String self)

      Determine if a String can be parsed into a BigDecimal.
      Parameters:
        `self` - a String
      Returns:
        true if the string can be parsed
      Since:
        1.5.0

    - #### isBigInteger

          public static boolean isBigInteger(CharSequence self)

      Determine if a CharSequence can be parsed as a BigInteger.
      Parameters:
        `self` - a CharSequence
      Returns:
        true if the CharSequence can be parsed
      Since:
        1.8.2
      See Also:
        `isBigInteger(String)`

    - #### isBigInteger

          public static boolean isBigInteger(String self)

      Determine if a String can be parsed into a BigInteger.
      Parameters:
        `self` - a String
      Returns:
        true if the string can be parsed
      Since:
        1.5.0

    - #### isCase

          public static boolean isCase(CharSequence caseValue,
                       Object switchValue)

      'Case' implementation for a CharSequence, which simply calls the equivalent method for String.
      Parameters:
        `caseValue` - the case value
        `switchValue` - the switch value
      Returns:
        true if the switchValue's toString() equals the caseValue
      Since:
        1.8.2

    - #### isCase

          public static boolean isCase(GString caseValue,
                       Object switchValue)

      'Case' implementation for a GString, which simply calls the equivalent method for String.
      Parameters:
        `caseValue` - the case value
        `switchValue` - the switch value
      Returns:
        true if the switchValue's toString() equals the caseValue
      Since:
        1.6.0

    - #### isCase

          public static boolean isCase(Pattern caseValue,
                       Object switchValue)

      'Case' implementation for the `Pattern` class, which allows testing a String against a number of regular expressions. For example:

          switch( str ) {
             case ~/one/ :
               // the regex 'one' matches the value of str
           }

      Note that this returns true for the case where both the pattern and the 'switch' values are `null`.
      Parameters:
        `caseValue` - the case value
        `switchValue` - the switch value
      Returns:
        true if the switchValue is deemed to match the caseValue
      Since:
        1.0

    - #### isCase

          public static boolean isCase(String caseValue,
                       Object switchValue)

      'Case' implementation for a String, which uses String#equals(Object) in order to allow Strings 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:
        `caseValue` - the case value
        `switchValue` - the switch value
      Returns:
        true if the switchValue's toString() equals the caseValue
      Since:
        1.0

    - #### isDouble

          public static boolean isDouble(CharSequence self)

      Determine if a CharSequence can be parsed as a Double.
      Parameters:
        `self` - a CharSequence
      Returns:
        true if the CharSequence can be parsed
      Since:
        1.8.2
      See Also:
        `isDouble(String)`

    - #### isDouble

          public static boolean isDouble(String self)

      Determine if a String can be parsed into a Double.
      Parameters:
        `self` - a String
      Returns:
        true if the string can be parsed
      Since:
        1.5.0

    - #### isFloat

          public static boolean isFloat(CharSequence self)

      Determine if a CharSequence can be parsed as a Float.
      Parameters:
        `self` - a CharSequence
      Returns:
        true if the CharSequence can be parsed
      Since:
        1.8.2
      See Also:
        `isFloat(String)`

    - #### isFloat

          public static boolean isFloat(String self)

      Determine if a String can be parsed into a Float.
      Parameters:
        `self` - a String
      Returns:
        true if the string can be parsed
      Since:
        1.5.0

    - #### isInteger

          public static boolean isInteger(CharSequence self)

      Determine if a CharSequence can be parsed as an Integer.
      Parameters:
        `self` - a CharSequence
      Returns:
        true if the CharSequence can be parsed
      Since:
        1.8.2
      See Also:
        `isInteger(String)`

    - #### isInteger

          public static boolean isInteger(String self)

      Determine if a String can be parsed into an Integer.
      Parameters:
        `self` - a String
      Returns:
        true if the string can be parsed
      Since:
        1.5.0

    - #### isLong

          public static boolean isLong(CharSequence self)

      Determine if a CharSequence can be parsed as a Long.
      Parameters:
        `self` - a CharSequence
      Returns:
        true if the CharSequence can be parsed
      Since:
        1.8.2
      See Also:
        `isLong(String)`

    - #### isLong

          public static boolean isLong(String self)

      Determine if a String can be parsed into a Long.
      Parameters:
        `self` - a String
      Returns:
        true if the string can be parsed
      Since:
        1.5.0

    - #### isNumber

          public static boolean isNumber(CharSequence self)

      Determine if a CharSequence can be parsed as a Number. Synonym for 'isBigDecimal()'.
      Parameters:
        `self` - a CharSequence
      Returns:
        true if the CharSequence can be parsed
      Since:
        1.8.2
      See Also:
        `isNumber(String)`

    - #### isNumber

          public static boolean isNumber(String self)

      Determine if a String can be parsed into a Number. Synonym for 'isBigDecimal()'.
      Parameters:
        `self` - a String
      Returns:
        true if the string can be parsed
      Since:
        1.5.0
      See Also:
        `isBigDecimal(String)`

    - #### iterator

          public static Iterator iterator(Matcher matcher)

      Returns an `Iterator` which traverses each match.
      Parameters:
        `matcher` - a Matcher object
      Returns:
        an Iterator for a Matcher
      Since:
        1.0
      See Also:
        `Matcher.group()`

    - #### leftShift

          public static StringBuilder leftShift(CharSequence self,
                                Object value)

      Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a CharSequence.
      Parameters:
        `self` - a CharSequence
        `value` - an Object
      Returns:
        a StringBuilder built from this CharSequence
      Since:
        1.8.2

    - #### leftShift

          public static StringBuffer leftShift(String self,
                               Object value)

      Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a String.
      Parameters:
        `self` - a String
        `value` - an Object
      Returns:
        a StringBuffer built from this string
      Since:
        1.0

    - #### leftShift

          public static StringBuffer leftShift(StringBuffer self,
                               Object value)

      Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a StringBuffer.
      Parameters:
        `self` - a StringBuffer
        `value` - a value to append
      Returns:
        the StringBuffer on which this operation was invoked
      Since:
        1.0

    - #### leftShift

          public static StringBuilder leftShift(StringBuilder self,
                                Object value)

      Overloads the left shift operator to provide syntactic sugar for appending to a StringBuilder.
      Parameters:
        `self` - a StringBuilder
        `value` - an Object
      Returns:
        the original StringBuilder
      Since:
        1.8.2

    - #### matches

          public static boolean matches(CharSequence self,
                        Pattern pattern)

      Tells whether or not a CharSequence matches the given compiled regular expression Pattern.
      Parameters:
        `self` - the CharSequence that is to be matched
        `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(String)`

    - #### matches

          public static boolean matches(String self,
                        Pattern pattern)

      Tells whether or not self matches the given compiled regular expression Pattern.
      Parameters:
        `self` - the string that is to be matched
        `pattern` - the regex Pattern to which the string of interest is to be matched
      Returns:
        true if the string matches
      Since:
        1.6.1
      See Also:
        `String.matches(String)`

    - #### minus

          public static CharSequence minus(CharSequence self,
                           Object target)

      Remove a part of a CharSequence by replacing the first occurrence of target within self with '' and returns the result.
      Parameters:
        `self` - a CharSequence
        `target` - an object representing the part to remove
      Returns:
        a CharSequence minus the part to be removed
      Since:
        1.8.2
      See Also:
        `minus(String, Object)`

    - #### minus

          public static String minus(String self,
                     Pattern pattern)

      Remove a part of a String. This replaces the first occurrence of the regex pattern within self with '' and returns the result.
      Parameters:
        `self` - a String
        `pattern` - a Pattern representing the part to remove
      Returns:
        a String minus the part to be removed
      Since:
        2.2.0

    - #### minus

          public static String minus(String self,
                     Object target)

      Remove a part of a String. This replaces the first occurrence of target.toString() within self with '' and returns the result.
      Parameters:
        `self` - a String
        `target` - an object representing the part to remove
      Returns:
        a String minus the part to be removed
      Since:
        1.0

    - #### multiply

          public static CharSequence multiply(CharSequence self,
                              Number factor)

      Repeat a CharSequence a certain number of times.
      Parameters:
        `self` - a CharSequence to be repeated
        `factor` - the number of times the CharSequence should be repeated
      Returns:
        a CharSequence composed of a repetition
      Throws:
        `IllegalArgumentException` - if the number of repetitions is < 0
      Since:
        1.8.2

    - #### multiply

          public static String multiply(String self,
                        Number factor)

      Repeat a String a certain number of times.
      Parameters:
        `self` - a String to be repeated
        `factor` - the number of times the String should be repeated
      Returns:
        a String composed of a repetition
      Throws:
        `IllegalArgumentException` - if the number of repetitions is < 0
      Since:
        1.0

    - #### next

          public static CharSequence next(CharSequence self)

      This method is called by the ++ operator for the class CharSequence.
      Parameters:
        `self` - a CharSequence
      Returns:
        an incremented CharSequence
      Since:
        1.8.2
      See Also:
        `next(String)`

    - #### next

          public static String next(String self)

      This method is called by the ++ operator for the class String. It increments the last character in the given string. If the character in the string is Character.MAX_VALUE a Character.MIN_VALUE will be appended. The empty string is incremented to a string consisting of the character Character.MIN_VALUE.
      Parameters:
        `self` - a String
      Returns:
        an incremented String
      Since:
        1.0

    - #### normalize

          public static CharSequence normalize(CharSequence self)

      Return a CharSequence with linefeeds and carriage returns normalized to linefeeds.
      Parameters:
        `self` - a CharSequence object
      Returns:
        the normalized CharSequence
      Since:
        1.8.2
      See Also:
        `normalize(String)`

    - #### normalize

          public static String normalize(String self)

      Return a String with linefeeds and carriage returns normalized to linefeeds.
      Parameters:
        `self` - a String object
      Returns:
        the normalized string
      Since:
        1.6.0

    - #### padLeft

          public static CharSequence padLeft(CharSequence self,
                             Number numberOfChars)

      Pad a CharSequence to a minimum length specified by `numberOfChars` by adding the space character to the left as many times as needed.
      Parameters:
        `self` - a CharSequence object
        `numberOfChars` - the total minimum number of characters of the resulting CharSequence
      Returns:
        the CharSequence padded to the left
      Since:
        1.8.2
      See Also:
        `padLeft(CharSequence, Number, CharSequence)`

    - #### padLeft

          public static CharSequence padLeft(CharSequence self,
                             Number numberOfChars,
                             CharSequence padding)

      Pad a CharSequence to a minimum length specified by `numberOfChars`, adding the supplied padding CharSequence as many times as needed to the left.
      Parameters:
        `self` - a CharSequence object
        `numberOfChars` - the total minimum number of characters of the resulting CharSequence
        `padding` - the characters used for padding
      Returns:
        the CharSequence padded to the left
      Since:
        1.8.2
      See Also:
        `padLeft(String, Number, String)`

    - #### padLeft

          public static String padLeft(String self,
                       Number numberOfChars)

      Pad a String 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:
        `self` - a String object
        `numberOfChars` - the total minimum number of characters of the resulting string
      Returns:
        the String padded to the left
      Since:
        1.0
      See Also:
        `padLeft(String, Number, String)`

    - #### padLeft

          public static String padLeft(String self,
                       Number numberOfChars,
                       String padding)

      Pad a String to a minimum length specified by `numberOfChars`, adding the supplied padding String as many times as needed to the left. 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, '*') }
           [2, 20, 200, 2000].each{ println it.toString().padLeft(5, '*_') }

      will produce output like:

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

      Parameters:
        `self` - a String object
        `numberOfChars` - the total minimum number of characters of the resulting string
        `padding` - the characters used for padding
      Returns:
        the String padded to the left
      Since:
        1.0

    - #### padRight

          public static CharSequence padRight(CharSequence self,
                              Number numberOfChars)

      Pad a CharSequence to a minimum length specified by `numberOfChars` by adding the space character to the right as many times as needed.
      Parameters:
        `self` - a CharSequence object
        `numberOfChars` - the total minimum number of characters of the resulting string
      Returns:
        the CharSequence padded to the right
      Since:
        1.8.2
      See Also:
        `padRight(String, Number)`

    - #### padRight

          public static CharSequence padRight(CharSequence self,
                              Number numberOfChars,
                              CharSequence padding)

      Pad a CharSequence to a minimum length specified by `numberOfChars`, adding the supplied padding CharSequence as many times as needed to the right.
      Parameters:
        `self` - a CharSequence object
        `numberOfChars` - the total minimum number of characters of the resulting CharSequence
        `padding` - the characters used for padding
      Returns:
        the CharSequence padded to the right
      Since:
        1.8.2
      See Also:
        `padRight(String, Number, String)`

    - #### padRight

          public static String padRight(String self,
                        Number numberOfChars)

      Pad a String to a minimum length specified by `numberOfChars` by adding the space character to the right 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:

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

      will produce output like:

           A    1
           BB   2
           CCC  3
           DDDD 4

      Parameters:
        `self` - a String object
        `numberOfChars` - the total minimum number of characters of the resulting string
      Returns:
        the String padded to the right
      Since:
        1.0

    - #### padRight

          public static String padRight(String self,
                        Number numberOfChars,
                        String padding)

      Pad a String to a minimum length specified by `numberOfChars`, adding the supplied padding String as many times as needed to the right. 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.padRight(5, '#') + it.size() }

      will produce output like:

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

      Parameters:
        `self` - a String object
        `numberOfChars` - the total minimum number of characters of the resulting string
        `padding` - the characters used for padding
      Returns:
        the String padded to the right
      Since:
        1.0

    - #### plus

          public static CharSequence plus(CharSequence left,
                          Object value)

      Appends the String representation of the given operand to this string.
      Parameters:
        `left` - a CharSequence
        `value` - any Object
      Returns:
        the new CharSequence with the object appended
      Since:
        1.8.2

    - #### plus

          public static String plus(Number value,
                    String right)

      Appends a String to the string representation of this number.
      Parameters:
        `value` - a Number
        `right` - a String
      Returns:
        a String
      Since:
        1.0

    - #### plus

          public static String plus(String left,
                    Object value)

      Appends the String representation of the given operand to this string.
      Parameters:
        `left` - a String
        `value` - any Object
      Returns:
        the new string with the object appended
      Since:
        1.0

    - #### plus

          public static String plus(String left,
                    CharSequence value)

      Appends the String representation of the given operand to this string.
      Parameters:
        `left` - a String
        `value` - any CharSequence
      Returns:
        the new string with the object appended
      Since:
        2.2

    - #### plus

          public static String plus(StringBuffer left,
                    String value)

      Appends a String to this StringBuffer.
      Parameters:
        `left` - a StringBuffer
        `value` - a String
      Returns:
        a String
      Since:
        1.0

    - #### previous

          public static CharSequence previous(CharSequence self)

      This method is called by the -- operator for the class CharSequence.
      Parameters:
        `self` - a CharSequence
      Returns:
        a CharSequence with a decremented digit at the end
      Since:
        1.8.2
      See Also:
        `previous(String)`

    - #### previous

          public static String previous(String self)

      This method is called by the -- operator for the class String. It decrements the last character in the given string. If the character in the string is Character.MIN_VALUE it will be deleted. The empty string can't be decremented.
      Parameters:
        `self` - a String
      Returns:
        a String with a decremented digit at the end
      Since:
        1.0

    - #### putAt

          public static void putAt(StringBuffer self,
                   EmptyRange range,
                   Object value)

      Support the range subscript operator for StringBuffer.
      Parameters:
        `self` - a StringBuffer
        `range` - a Range
        `value` - the object that's toString() will be inserted
      Since:
        1.0

    - #### putAt

          public static void putAt(StringBuffer self,
                   IntRange range,
                   Object value)

      Support the range subscript operator for StringBuffer. Index values are treated as characters within the buffer.
      Parameters:
        `self` - a StringBuffer
        `range` - a Range
        `value` - the object that's toString() will be inserted
      Since:
        1.0

    - #### readLines

          public static List<CharSequence> readLines(CharSequence self)
                                              throws IOException

      Return the lines of a CharSequence as a List of CharSequence.
      Parameters:
        `self` - a CharSequence object
      Returns:
        a list of lines
      Throws:
        `IOException` - if an error occurs
      Since:
        1.8.2

    - #### readLines

          public static List<String> readLines(String self)
                                        throws IOException

      Return the lines of a String as a List of Strings.
      Parameters:
        `self` - a String object
      Returns:
        a list of lines
      Throws:
        `IOException` - if an error occurs
      Since:
        1.5.5

    - #### replaceAll

          public static CharSequence replaceAll(CharSequence self,
                                CharSequence regex,
                                CharSequence replacement)

      Replaces each substring of this CharSequence that matches the given regular expression with the given replacement.
      Parameters:
        `self` - a CharSequence
        `regex` - the capturing regex
        `replacement` - the capturing regex
      Returns:
        a CharSequence with replaced content
      Throws:
        `PatternSyntaxException` - if the regular expression's syntax is invalid
      Since:
        1.8.2
      See Also:
        `String.replaceAll(String, String)`

    - #### replaceAll

          public static CharSequence replaceAll(CharSequence self,
                                CharSequence regex,
                                Closure closure)

      Replaces all occurrences of a captured group by the result of a closure on that text.
      Parameters:
        `self` - a CharSequence
        `regex` - the capturing regex
        `closure` - the closure to apply on each captured group
      Returns:
        a CharSequence with replaced content
      Throws:
        `PatternSyntaxException` - if the regular expression's syntax is invalid
      Since:
        1.8.2
      See Also:
        `replaceAll(String, java.util.regex.Pattern, groovy.lang.Closure)`

    - #### replaceAll

          public static CharSequence replaceAll(CharSequence self,
                                Pattern pattern,
                                CharSequence replacement)

      Replaces all substrings of a CharSequence that match the given compiled regular expression with the given replacement.
      Parameters:
        `self` - the CharSequence that is to be matched
        `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 resulting `CharSequence`
      Since:
        1.8.2
      See Also:
        `replaceAll(String, java.util.regex.Pattern, String)`

    - #### replaceAll

          public static String replaceAll(CharSequence self,
                          Pattern pattern,
                          Closure closure)

      Replaces all occurrences of a captured group by the result of a closure call on that text.
      Parameters:
        `self` - a CharSequence
        `pattern` - the capturing regex Pattern
        `closure` - the closure to apply on each captured group
      Returns:
        a CharSequence with replaced content
      Since:
        1.8.2
      See Also:
        `replaceAll(String, java.util.regex.Pattern, groovy.lang.Closure)`

    - #### replaceAll

          public static String replaceAll(String self,
                          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" == "hello world".replaceAll(~"(o)") { it[0].toUpperCase() }

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

               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-" == "foobar-FooBar-".replaceAll(~"(([fF][oO]{2})[bB]ar)", { Object[] it -> it[0].toUpperCase() })

               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 "FOO-FOO-" == "foobar-FooBar-".replaceAll("(([fF][oO]{2})[bB]ar)", { x, y, z -> z.toUpperCase() })

               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:
        `self` - a String
        `pattern` - the capturing regex Pattern
        `closure` - the closure to apply on each captured group
      Returns:
        a String with replaced content
      Since:
        1.6.8
      See Also:
        `Matcher.quoteReplacement(String)`

    - #### replaceAll

          public static String replaceAll(String self,
                          Pattern pattern,
                          String replacement)

      Replaces all substrings of a String 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 than if it were being treated as a literal replacement string; see `Matcher.replaceAll(java.lang.String)`. Use `Matcher.quoteReplacement(java.lang.String)` to suppress the special meaning of these characters, if desired.

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

      Parameters:
        `self` - the string that is to be matched
        `pattern` - the regex Pattern to which the string of interest is to be matched
        `replacement` - the string to be substituted for the first match
      Returns:
        The resulting `String`
      Since:
        1.6.1
      See Also:
        `String.replaceAll(String, String)`

    - #### replaceAll

          public static String replaceAll(String self,
                          String regex,
                          Closure closure)

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

      For examples,

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

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

               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 "FOO-FOO-" == "foobar-FooBar-".replaceAll("(([fF][oO]{2})[bB]ar)", { x, y, z -> z.toUpperCase() })

               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:
        `self` - a String
        `regex` - the capturing regex
        `closure` - the closure to apply on each captured group
      Returns:
        a String with replaced content
      Throws:
        `PatternSyntaxException` - if the regular expression's syntax is invalid
      Since:
        1.0
      See Also:
        `Matcher.quoteReplacement(String)`, `replaceAll(String, java.util.regex.Pattern, groovy.lang.Closure)`

    - #### replaceFirst

          public static String replaceFirst(CharSequence self,
                            CharSequence regex,
                            CharSequence replacement)

      Replaces the first substring of this CharSequence that matches the given regular expression with the given replacement.
      Parameters:
        `self` - a CharSequence
        `regex` - the capturing regex
        `replacement` - the capturing regex
      Returns:
        a CharSequence with replaced content
      Throws:
        `PatternSyntaxException` - if the regular expression's syntax is invalid
      Since:
        1.8.2
      See Also:
        `String.replaceAll(String, String)`

    - #### replaceFirst

          public static String replaceFirst(CharSequence self,
                            CharSequence regex,
                            Closure closure)

      Replaces the first occurrence of a captured group by the result of a closure call on that text.
      Parameters:
        `self` - a CharSequence
        `regex` - the capturing regex
        `closure` - the closure to apply on the first captured group
      Returns:
        a CharSequence with replaced content
      Throws:
        `PatternSyntaxException` - if the regular expression's syntax is invalid
      Since:
        1.8.2
      See Also:
        `replaceFirst(String, String, groovy.lang.Closure)`

    - #### replaceFirst

          public static CharSequence replaceFirst(CharSequence self,
                                  Pattern pattern,
                                  CharSequence replacement)

      Replaces the first substring of a CharSequence that matches the given compiled regular expression with the given replacement.
      Parameters:
        `self` - the CharSequence that is to be matched
        `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 resulting `CharSequence`
      Since:
        1.8.2
      See Also:
        `replaceFirst(String, java.util.regex.Pattern, String)`

    - #### replaceFirst

          public static String replaceFirst(CharSequence self,
                            Pattern pattern,
                            Closure closure)

      Replaces the first occurrence of a captured group by the result of a closure call on that text.
      Parameters:
        `self` - a CharSequence
        `pattern` - the capturing regex Pattern
        `closure` - the closure to apply on the first captured group
      Returns:
        a CharSequence with replaced content
      Since:
        1.8.2
      See Also:
        `replaceFirst(String, java.util.regex.Pattern, groovy.lang.Closure)`

    - #### replaceFirst

          public static String replaceFirst(String self,
                            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:
        `self` - a String
        `pattern` - the capturing regex Pattern
        `closure` - the closure to apply on the first captured group
      Returns:
        a String with replaced content
      Since:
        1.7.7
      See Also:
        `replaceAll(String, java.util.regex.Pattern, groovy.lang.Closure)`

    - #### replaceFirst

          public static String replaceFirst(String self,
                            Pattern pattern,
                            String replacement)

      Replaces the first substring of a String 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 than if it were being treated as a literal replacement string; see `Matcher.replaceFirst(java.lang.String)`. Use `Matcher.quoteReplacement(java.lang.String)` to suppress the special meaning of these characters, if desired.

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

      Parameters:
        `self` - the string that is to be matched
        `pattern` - the regex Pattern to which the string of interest is to be matched
        `replacement` - the string to be substituted for the first match
      Returns:
        The resulting `String`
      Since:
        1.6.1
      See Also:
        `String.replaceFirst(String, String)`

    - #### replaceFirst

          public static String replaceFirst(String self,
                            String 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" == "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:
        `self` - a String
        `regex` - the capturing regex
        `closure` - the closure to apply on the first captured group
      Returns:
        a String with replaced content
      Throws:
        `PatternSyntaxException` - if the regular expression's syntax is invalid
      Since:
        1.7.7
      See Also:
        `Matcher.quoteReplacement(String)`, `replaceFirst(String, java.util.regex.Pattern, groovy.lang.Closure)`

    - #### reverse

          public static CharSequence reverse(CharSequence self)

      Creates a new CharSequence which is the reverse (backwards) of this string
      Parameters:
        `self` - a CharSequence
      Returns:
        a new CharSequence with all the characters reversed.
      Since:
        1.8.2
      See Also:
        `reverse(String)`

    - #### reverse

          public static String reverse(String self)

      Creates a new string which is the reverse (backwards) of this string
      Parameters:
        `self` - a String
      Returns:
        a new string with all the characters reversed.
      Since:
        1.0
      See Also:
        `StringBuilder.reverse()`

    - #### setIndex

          public static void setIndex(Matcher matcher,
                      int idx)

      Set the position of the given Matcher to the given index.
      Parameters:
        `matcher` - a Matcher
        `idx` - the index number
      Since:
        1.0

    - #### size

          public static int size(CharSequence text)

      Provide the standard Groovy `size()` method for `CharSequence`.
      Parameters:
        `text` - a CharSequence
      Returns:
        the length of the CharSequence
      Since:
        1.8.2

    - #### size

          public static long size(Matcher self)

      Provide the standard Groovy `size()` method for `Matcher`.
      Parameters:
        `self` - a matcher object
      Returns:
        the matcher's size (count)
      Since:
        1.5.0

    - #### size

          public static int size(String text)

      Provide the standard Groovy `size()` method for `String`.
      Parameters:
        `text` - a String
      Returns:
        the length of the String
      Since:
        1.0

    - #### size

          public static int size(StringBuffer buffer)

      Provide the standard Groovy `size()` method for `StringBuffer`.
      Parameters:
        `buffer` - a StringBuffer
      Returns:
        the length of the StringBuffer
      Since:
        1.0

    - #### split

          public static CharSequence[] split(CharSequence self)

      Convenience method to split a CharSequence (with whitespace as delimiter). Similar to tokenize, but returns an Array of CharSequence instead of a List.
      Parameters:
        `self` - the CharSequence to split
      Returns:
        CharSequence[] result of split
      Since:
        1.8.2
      See Also:
        `split(String)`

    - #### split

          public static String[] split(GString self)

      Convenience method to split a GString (with whitespace as delimiter).
      Parameters:
        `self` - the GString to split
      Returns:
        String[] result of split
      Since:
        1.6.1
      See Also:
        `split(String)`

    - #### split

          public static String[] split(String self)

      Convenience method to split a string (with whitespace as delimiter) Like tokenize, but returns an Array of Strings instead of a List
      Parameters:
        `self` - the string to split
      Returns:
        String[] result of split
      Since:
        1.5.0

    - #### splitEachLine

          public static <T> T splitEachLine(CharSequence self,
                            CharSequence regex,
                            Closure<T> closure)
                                 throws IOException

      Iterates through the given CharSequence line by line, splitting each line using the given separator. The list of tokens for each line is then passed to the given closure.
      Parameters:
        `self` - a CharSequence
        `regex` - the delimiting regular expression
        `closure` - a closure
      Returns:
        the last value returned by the closure
      Throws:
        `IOException` - if an error occurs
        `PatternSyntaxException` - if the regular expression's syntax is invalid
      Since:
        1.8.2
      See Also:
        `splitEachLine(String, String, groovy.lang.Closure)`

    - #### splitEachLine

          public static <T> T splitEachLine(CharSequence self,
                            Pattern pattern,
                            Closure<T> closure)
                                 throws IOException

      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:
        `self` - a CharSequence
        `pattern` - the regular expression Pattern for the delimiter
        `closure` - a closure
      Returns:
        the last value returned by the closure
      Throws:
        `IOException` - if an error occurs
      Since:
        1.8.2
      See Also:
        `splitEachLine(String, java.util.regex.Pattern, groovy.lang.Closure)`

    - #### splitEachLine

          public static <T> T splitEachLine(String self,
                            Pattern pattern,
                            Closure<T> closure)
                                 throws IOException

      Iterates through the given String 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:
        `self` - a String
        `pattern` - the regular expression Pattern for the delimiter
        `closure` - a closure
      Returns:
        the last value returned by the closure
      Throws:
        `IOException` - if an error occurs
      Since:
        1.6.8
      See Also:
        `Pattern.split(CharSequence)`

    - #### splitEachLine

          public static <T> T splitEachLine(String self,
                            String regex,
                            Closure<T> closure)
                                 throws IOException

      Iterates through the given String line by line, splitting each line using the given separator. The list of tokens for each line is then passed to the given closure.
      Parameters:
        `self` - a String
        `regex` - the delimiting regular expression
        `closure` - a closure
      Returns:
        the last value returned by the closure
      Throws:
        `IOException` - if an error occurs
        `PatternSyntaxException` - if the regular expression's syntax is invalid
      Since:
        1.5.5
      See Also:
        `String.split(String)`

    - #### stripIndent

          public static CharSequence stripIndent(CharSequence self)

      Strip 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.
      Parameters:
        `self` - The CharSequence to strip the leading spaces from
      Returns:
        the stripped CharSequence
      Since:
        1.8.2
      See Also:
        `stripIndent(String)`

    - #### stripIndent

          public static CharSequence stripIndent(CharSequence self,
                                 int numChars)

      Strip `numChar` leading characters from every line in a CharSequence.
      Parameters:
        `self` - The CharSequence to strip the characters from
        `numChars` - The number of characters to strip
      Returns:
        the stripped CharSequence
      Since:
        1.8.2

    - #### stripIndent

          public static String stripIndent(String self)

      Strip leading spaces from every line in a String. 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()

      Parameters:
        `self` - The String to strip the leading spaces from
      Returns:
        the stripped String
      Since:
        1.7.3
      See Also:
        `stripIndent(String, int)`

    - #### stripIndent

          public static String stripIndent(String self,
                           int numChars)

      Strip `numChar` leading characters from every line in a String.

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

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

    - #### stripMargin

          public static CharSequence stripMargin(CharSequence self)

      Strip leading whitespace/control characters followed by '|' from every line in a CharSequence.
      Parameters:
        `self` - The CharSequence to strip the margin from
      Returns:
        the stripped CharSequence
      Since:
        1.8.2
      See Also:
        `stripMargin(CharSequence, char)`

    - #### stripMargin

          public static CharSequence stripMargin(CharSequence self,
                                 char marginChar)

      Strip leading whitespace/control characters followed by `marginChar` from every line in a String.
      Parameters:
        `self` - The CharSequence to strip the margin from
        `marginChar` - Any character that serves as margin delimiter
      Returns:
        the stripped CharSequence
      Since:
        1.8.2
      See Also:
        `stripMargin(String, char)`

    - #### stripMargin

          public static String stripMargin(CharSequence self,
                           CharSequence marginChar)

      Strip leading whitespace/control characters followed by `marginChar` from every line in a CharSequence.
      Parameters:
        `self` - The CharSequence to strip the margin from
        `marginChar` - Any character that serves as margin delimiter
      Returns:
        the stripped CharSequence
      Since:
        1.8.2
      See Also:
        `stripMargin(String, String)`

    - #### stripMargin

          public static String stripMargin(String self)

      Strip leading whitespace/control characters followed by '|' from every line in a String.

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

      Parameters:
        `self` - The String to strip the margin from
      Returns:
        the stripped String
      Since:
        1.7.3
      See Also:
        `stripMargin(String, char)`

    - #### stripMargin

          public static String stripMargin(String self,
                           char marginChar)

      Strip leading whitespace/control characters followed by `marginChar` from every line in a String.

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

      Parameters:
        `self` - The String to strip the margin from
        `marginChar` - Any character that serves as margin delimiter
      Returns:
        the stripped String
      Since:
        1.7.3

    - #### stripMargin

          public static String stripMargin(String self,
                           String marginChar)

      Strip leading whitespace/control characters followed by `marginChar` from every line in a String.
      Parameters:
        `self` - The String to strip the margin from
        `marginChar` - Any character that serves as margin delimiter
      Returns:
        the stripped String
      Since:
        1.7.3
      See Also:
        `stripMargin(String, char)`

    - #### take

          public static CharSequence take(CharSequence self,
                          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:
        `self` - the original CharSequence
        `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 then `num` elements.
      Since:
        1.8.1

    - #### takeWhile

          public static CharSequence takeWhile(CharSequence self,
                               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:
        `self` - the original CharSequence
        `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

    - #### toBigDecimal

          public static BigDecimal toBigDecimal(CharSequence self)

      Parse a CharSequence into a BigDecimal
      Parameters:
        `self` - a CharSequence
      Returns:
        a BigDecimal
      Since:
        1.8.2
      See Also:
        `toBigDecimal(String)`

    - #### toBigDecimal

          public static BigDecimal toBigDecimal(String self)

      Parse a String into a BigDecimal
      Parameters:
        `self` - a String
      Returns:
        a BigDecimal
      Since:
        1.0

    - #### toBigInteger

          public static BigInteger toBigInteger(CharSequence self)

      Parse a CharSequence into a BigInteger
      Parameters:
        `self` - a CharSequence
      Returns:
        a BigInteger
      Since:
        1.8.2
      See Also:
        `toBigInteger(String)`

    - #### toBigInteger

          public static BigInteger toBigInteger(String self)

      Parse a String into a BigInteger
      Parameters:
        `self` - a String
      Returns:
        a BigInteger
      Since:
        1.0

    - #### toBoolean

          public static Boolean toBoolean(String self)

      Converts the given string into a Boolean object. If the trimmed string is "true", "y" or "1" (ignoring case) then the result is true otherwise it is false.
      Parameters:
        `self` - a String
      Returns:
        The Boolean value
      Since:
        1.0

    - #### toCharacter

          public static Character toCharacter(String self)

      Converts the given string into a Character object using the first character in the string.
      Parameters:
        `self` - a String
      Returns:
        the first Character
      Since:
        1.0

    - #### toDouble

          public static Double toDouble(CharSequence self)

      Parse a CharSequence into a Double
      Parameters:
        `self` - a CharSequence
      Returns:
        a Double
      Since:
        1.8.2
      See Also:
        `toDouble(String)`

    - #### toDouble

          public static Double toDouble(String self)

      Parse a String into a Double
      Parameters:
        `self` - a String
      Returns:
        a Double
      Since:
        1.0

    - #### toFloat

          public static Float toFloat(CharSequence self)

      Parse a CharSequence into a Float
      Parameters:
        `self` - a CharSequence
      Returns:
        a Float
      Since:
        1.8.2
      See Also:
        `toFloat(String)`

    - #### toFloat

          public static Float toFloat(String self)

      Parse a String into a Float
      Parameters:
        `self` - a String
      Returns:
        a Float
      Since:
        1.0

    - #### toInteger

          public static Integer toInteger(CharSequence self)

      Parse a CharSequence into an Integer
      Parameters:
        `self` - a CharSequence
      Returns:
        an Integer
      Since:
        1.8.2
      See Also:
        `toInteger(String)`

    - #### toInteger

          public static Integer toInteger(String self)

      Parse a String into an Integer
      Parameters:
        `self` - a String
      Returns:
        an Integer
      Since:
        1.0

    - #### tokenize

          public static List<CharSequence> tokenize(CharSequence self)

      Tokenize a CharSequence (with a whitespace as the delimiter).
      Parameters:
        `self` - a CharSequence
      Returns:
        a List of tokens
      Since:
        1.8.2
      See Also:
        `tokenize(String)`

    - #### tokenize

          public static List<CharSequence> tokenize(CharSequence self,
                                    Character token)

      Tokenize a CharSequence based on the given character delimiter.
      Parameters:
        `self` - a CharSequence
        `token` - the delimiter
      Returns:
        a List of tokens
      Since:
        1.8.2
      See Also:
        `tokenize(String, Character)`

    - #### tokenize

          public static List<CharSequence> tokenize(CharSequence self,
                                    CharSequence token)

      Tokenize a CharSequence based on the given CharSequence delimiter.
      Parameters:
        `self` - a CharSequence
        `token` - the delimiter
      Returns:
        a List of tokens
      Since:
        1.8.2
      See Also:
        `tokenize(String, String)`

    - #### tokenize

          public static List<String> tokenize(String self)

      Tokenize a String (with a whitespace as the delimiter).
      Parameters:
        `self` - a String
      Returns:
        a List of tokens
      Since:
        1.0
      See Also:
        `StringTokenizer.StringTokenizer(String)`

    - #### tokenize

          public static List<String> tokenize(String self,
                              Character token)

      Tokenize a String based on the given character delimiter. For example:

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

      Parameters:
        `self` - a String
        `token` - the delimiter
      Returns:
        a List of tokens
      Since:
        1.7.2
      See Also:
        `StringTokenizer.StringTokenizer(String, String)`

    - #### tokenize

          public static List<String> tokenize(String self,
                              String token)

      Tokenize a String based on the given string delimiter.
      Parameters:
        `self` - a String
        `token` - the delimiter
      Returns:
        a List of tokens
      Since:
        1.0
      See Also:
        `StringTokenizer.StringTokenizer(String, String)`

    - #### toList

          public static List<CharSequence> toList(CharSequence self)

      Converts the given CharSequence into a List of CharSequence of one character.
      Parameters:
        `self` - a CharSequence
      Returns:
        a List of characters (a 1-character CharSequence)
      Since:
        1.8.2
      See Also:
        `toSet(String)`

    - #### toList

          public static List<String> toList(String self)

      Converts the given String into a List of strings of one character.
      Parameters:
        `self` - a String
      Returns:
        a List of characters (a 1-character String)
      Since:
        1.0

    - #### toLong

          public static Long toLong(CharSequence self)

      Parse a CharSequence into a Long
      Parameters:
        `self` - a CharSequence
      Returns:
        a Long
      Since:
        1.8.2
      See Also:
        `toLong(String)`

    - #### toLong

          public static Long toLong(String self)

      Parse a String into a Long
      Parameters:
        `self` - a String
      Returns:
        a Long
      Since:
        1.0

    - #### toSet

          public static Set<CharSequence> toSet(CharSequence self)

      Converts the given CharSequence into a Set of unique CharSequence of one character.
      Parameters:
        `self` - a CharSequence
      Returns:
        a Set of unique character CharSequence (each a 1-character CharSequence)
      Since:
        1.8.2
      See Also:
        `toSet(String)`

    - #### toSet

          public static Set<String> toSet(String self)

      Converts the given String into a Set of unique strings of one character.

      Example usage:

           assert 'groovy'.toSet() == ['v', 'g', 'r', 'o', 'y'] as Set
           assert "abc".toSet().iterator()[0] instanceof String

      Parameters:
        `self` - a String
      Returns:
        a Set of unique character Strings (each a 1-character String)
      Since:
        1.8.0

    - #### toShort

          public static Short toShort(CharSequence self)

      Parse a CharSequence into a Short
      Parameters:
        `self` - a CharSequence
      Returns:
        a Short
      Since:
        1.8.2
      See Also:
        `toShort(String)`

    - #### toShort

          public static Short toShort(String self)

      Parse a String into a Short
      Parameters:
        `self` - a String
      Returns:
        a Short
      Since:
        1.5.7

    - #### tr

          public static CharSequence tr(CharSequence self,
                        CharSequence sourceSet,
                        CharSequence replacementSet)
                                 throws ClassNotFoundException

      Translates a string by replacing characters from the sourceSet with characters from replacementSet.
      Parameters:
        `self` - the CharSequence that is to be translated
        `sourceSet` - the set of characters to translate from
        `replacementSet` - the set of replacement characters
      Returns:
        The resulting translated `CharSequence`
      Throws:
        `ClassNotFoundException`
      Since:
        1.8.2
      See Also:
        `tr(String, String, String)`

    - #### tr

          public static String tr(String self,
                  String sourceSet,
                  String replacementSet)
                           throws ClassNotFoundException

      Translates a string by replacing characters from the sourceSet with characters from replacementSet. If the first character from sourceSet appears in the string, it will be replaced with the first character from replacementSet. If the second character from sourceSet appears in the string, 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:
        `self` - the string that is to be translated
        `sourceSet` - the set of characters to translate from
        `replacementSet` - the set of replacement characters
      Returns:
        The resulting translated `String`
      Throws:
        `ClassNotFoundException`
      Since:
        1.7.3
      See Also:
        `StringUtil.tr(String, String, String)`

    - #### unexpand

          public static CharSequence unexpand(CharSequence self)

      Replaces sequences of whitespaces with tabs using tabStops of size 8.
      Parameters:
        `self` - A CharSequence to unexpand
      Returns:
        The unexpanded CharSequence
      Since:
        1.8.2
      See Also:
        `unexpand(String)`

    - #### unexpand

          public static CharSequence unexpand(CharSequence self,
                              int tabStop)

      Replaces sequences of whitespaces with tabs.
      Parameters:
        `self` - A CharSequence to unexpand
        `tabStop` - The number of spaces a tab represents
      Returns:
        The unexpanded CharSequence
      Since:
        1.8.2
      See Also:
        `unexpand(String, int)`

    - #### unexpand

          public static String unexpand(String self)

      Replaces sequences of whitespaces with tabs using tabStops of size 8.
      Parameters:
        `self` - A String to unexpand
      Returns:
        The unexpanded String
      Since:
        1.7.3
      See Also:
        `unexpand(String, int)`

    - #### unexpand

          public static String unexpand(String self,
                        int tabStop)

      Replaces sequences of whitespaces with tabs.
      Parameters:
        `self` - A String to unexpand
        `tabStop` - The number of spaces a tab represents
      Returns:
        The unexpanded String
      Since:
        1.7.3

    - #### unexpandLine

          public static CharSequence unexpandLine(CharSequence self,
                                  int tabStop)

      Replaces sequences of whitespaces with tabs within a line.
      Parameters:
        `self` - A line to unexpand
        `tabStop` - The number of spaces a tab represents
      Returns:
        The unexpanded CharSequence
      Since:
        1.8.2
      See Also:
        `unexpandLine(String, int)`

    - #### unexpandLine

          public static String unexpandLine(String self,
                            int tabStop)

      Replaces sequences of whitespaces with tabs within a line.
      Parameters:
        `self` - A line to unexpand
        `tabStop` - The number of spaces a tab represents
      Returns:
        The unexpanded String
      Since:
        1.7.3