Package org.codehaus.groovy.runtime

# Class GStringImpl

java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.lang.GString
org.codehaus.groovy.runtime.GStringImpl

All Implemented Interfaces:
  `Buildable`, `GroovyObject`, `Writable`, `java.io.Serializable`, `java.lang.CharSequence`, `java.lang.Comparable`

    public class GStringImpl
    extends GString

Default implementation of a GString used by the compiler. A GString consist of a list of values and strings which can be combined to create a new String.

See Also:
  `GString`, Serialized Form

- ## Field Summary

  ### Fields inherited from class groovy.lang.GString

  `EMPTY, EMPTY_OBJECT_ARRAY, EMPTY_STRING_ARRAY`

- ## Constructor Summary

  Constructors
  Constructor | Description
  --- | ---
  `GStringImpl​(java.lang.Object[] values, java.lang.String[] strings)` | Create a new GString with values and strings.

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `int` | `codePointAt​(int index)` |
  `int` | `codePointBefore​(int index)` |
  `int` | `codePointCount​(int beginIndex, int endIndex)` |
  `int` | `compareTo​(java.lang.String anotherString)` |
  `int` | `compareToIgnoreCase​(java.lang.String str)` |
  `java.lang.String` | `concat​(java.lang.String str)` |
  `boolean` | `contains​(java.lang.CharSequence s)` |
  `boolean` | `contentEquals​(java.lang.CharSequence cs)` |
  `boolean` | `contentEquals​(java.lang.StringBuffer sb)` |
  `boolean` | `endsWith​(java.lang.String suffix)` |
  `boolean` | `equalsIgnoreCase​(java.lang.String anotherString)` |
  `byte[]` | `getBytes​(java.nio.charset.Charset charset)` |
  `void` | `getChars​(int srcBegin, int srcEnd, char[] dst, int dstBegin)` |
  `java.lang.String[]` | `getStrings()` | Get the strings of this GString.
  `int` | `indexOf​(int ch)` |
  `int` | `indexOf​(int ch, int fromIndex)` |
  `int` | `indexOf​(java.lang.String str)` |
  `int` | `indexOf​(java.lang.String str, int fromIndex)` |
  `java.lang.String` | `intern()` |
  `boolean` | `isEmpty()` |
  `int` | `lastIndexOf​(int ch)` |
  `int` | `lastIndexOf​(int ch, int fromIndex)` |
  `int` | `lastIndexOf​(java.lang.String str)` |
  `int` | `lastIndexOf​(java.lang.String str, int fromIndex)` |
  `boolean` | `matches​(java.lang.String regex)` |
  `int` | `offsetByCodePoints​(int index, int codePointOffset)` |
  `boolean` | `regionMatches​(boolean ignoreCase, int toffset, java.lang.String other, int ooffset, int len)` |
  `boolean` | `regionMatches​(int toffset, java.lang.String other, int ooffset, int len)` |
  `java.lang.String` | `replace​(char oldChar, char newChar)` |
  `java.lang.String` | `replace​(java.lang.CharSequence target, java.lang.CharSequence replacement)` |
  `java.lang.String` | `replaceAll​(java.lang.String regex, java.lang.String replacement)` |
  `java.lang.String` | `replaceFirst​(java.lang.String regex, java.lang.String replacement)` |
  `java.lang.String[]` | `split​(java.lang.String regex)` |
  `java.lang.String[]` | `split​(java.lang.String regex, int limit)` |
  `boolean` | `startsWith​(java.lang.String prefix)` |
  `boolean` | `startsWith​(java.lang.String prefix, int toffset)` |
  `java.lang.String` | `substring​(int beginIndex)` |
  `java.lang.String` | `substring​(int beginIndex, int endIndex)` |
  `char[]` | `toCharArray()` |
  `java.lang.String` | `toLowerCase()` |
  `java.lang.String` | `toLowerCase​(java.util.Locale locale)` |
  `java.lang.String` | `toUpperCase()` |
  `java.lang.String` | `toUpperCase​(java.util.Locale locale)` |
  `java.lang.String` | `trim()` |

  ### Methods inherited from class groovy.lang.GString

  `build, charAt, compareTo, equals, equals, getBytes, getBytes, getValue, getValueCount, getValues, hashCode, invokeMethod, length, negate, plus, plus, subSequence, toString, writeTo`

  ### Methods inherited from class groovy.lang.GroovyObjectSupport

  `getMetaClass, setMetaClass`

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

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface java.lang.CharSequence

  `chars, codePoints`

  ### Methods inherited from interface groovy.lang.GroovyObject

  `getProperty, setProperty`

- ## Constructor Details

  - ### GStringImpl

    public GStringImpl​(java.lang.Object[] values, java.lang.String[] strings)
    Create a new GString with values and strings.

    Each value is prefixed by a string, after the last value an additional String might be used. This means `strings.length == values.length || strings.length == values.length + 1`.

    NOTE: The lengths are not checked. Using different lengths might result in unpredictable behaviour.

    Parameters:
      `values` - the value parts
      `strings` - the string parts

- ## Method Details

  - ### getStrings

    public java.lang.String[] getStrings()
    Get the strings of this GString.

    This methods returns the same array as used in the constructor. Changing the values will result in changes of the GString. It is not recommended to do so.

    Specified by:
      `getStrings` in class `GString`

  - ### trim

    public java.lang.String trim()

  - ### isEmpty

    public boolean isEmpty()

  - ### codePointAt

    public int codePointAt​(int index)

  - ### codePointBefore

    public int codePointBefore​(int index)

  - ### codePointCount

    public int codePointCount​(int beginIndex, int endIndex)

  - ### offsetByCodePoints

    public int offsetByCodePoints​(int index, int codePointOffset)

  - ### getChars

    public void getChars​(int srcBegin, int srcEnd, char[] dst, int dstBegin)

  - ### getBytes

    public byte[] getBytes​(java.nio.charset.Charset charset)

  - ### contentEquals

    public boolean contentEquals​(java.lang.StringBuffer sb)

  - ### contentEquals

    public boolean contentEquals​(java.lang.CharSequence cs)

  - ### equalsIgnoreCase

    public boolean equalsIgnoreCase​(java.lang.String anotherString)

  - ### compareTo

    public int compareTo​(java.lang.String anotherString)

  - ### compareToIgnoreCase

    public int compareToIgnoreCase​(java.lang.String str)

  - ### regionMatches

    public boolean regionMatches​(int toffset, java.lang.String other, int ooffset, int len)

  - ### regionMatches

    public boolean regionMatches​(boolean ignoreCase, int toffset, java.lang.String other, int ooffset, int len)

  - ### startsWith

    public boolean startsWith​(java.lang.String prefix, int toffset)

  - ### startsWith

    public boolean startsWith​(java.lang.String prefix)

  - ### endsWith

    public boolean endsWith​(java.lang.String suffix)

  - ### indexOf

    public int indexOf​(int ch)

  - ### indexOf

    public int indexOf​(int ch, int fromIndex)

  - ### lastIndexOf

    public int lastIndexOf​(int ch)

  - ### lastIndexOf

    public int lastIndexOf​(int ch, int fromIndex)

  - ### indexOf

    public int indexOf​(java.lang.String str)

  - ### indexOf

    public int indexOf​(java.lang.String str, int fromIndex)

  - ### lastIndexOf

    public int lastIndexOf​(java.lang.String str)

  - ### lastIndexOf

    public int lastIndexOf​(java.lang.String str, int fromIndex)

  - ### substring

    public java.lang.String substring​(int beginIndex)

  - ### substring

    public java.lang.String substring​(int beginIndex, int endIndex)

  - ### concat

    public java.lang.String concat​(java.lang.String str)

  - ### replace

    public java.lang.String replace​(char oldChar, char newChar)

  - ### matches

    public boolean matches​(java.lang.String regex)

  - ### contains

    public boolean contains​(java.lang.CharSequence s)

  - ### replaceFirst

    public java.lang.String replaceFirst​(java.lang.String regex, java.lang.String replacement)

  - ### replaceAll

    public java.lang.String replaceAll​(java.lang.String regex, java.lang.String replacement)

  - ### replace

    public java.lang.String replace​(java.lang.CharSequence target, java.lang.CharSequence replacement)

  - ### split

    public java.lang.String[] split​(java.lang.String regex, int limit)

  - ### split

    public java.lang.String[] split​(java.lang.String regex)

  - ### toLowerCase

    public java.lang.String toLowerCase​(java.util.Locale locale)

  - ### toLowerCase

    public java.lang.String toLowerCase()

  - ### toUpperCase

    public java.lang.String toUpperCase​(java.util.Locale locale)

  - ### toUpperCase

    public java.lang.String toUpperCase()

  - ### toCharArray

    public char[] toCharArray()

  - ### intern

    public java.lang.String intern()