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
,Serializable
,CharSequence
,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(Object[] values, 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(String anotherString)
int
compareToIgnoreCase(String str)
String
concat(String str)
boolean
contains(CharSequence s)
boolean
contentEquals(CharSequence cs)
boolean
contentEquals(StringBuffer sb)
boolean
endsWith(String suffix)
boolean
equalsIgnoreCase(String anotherString)
byte[]
getBytes(Charset charset)
void
getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
String[]
getStrings()
Get the strings of this GString.int
indexOf(int ch)
int
indexOf(int ch, int fromIndex)
int
indexOf(String str)
int
indexOf(String str, int fromIndex)
String
intern()
boolean
isEmpty()
int
lastIndexOf(int ch)
int
lastIndexOf(int ch, int fromIndex)
int
lastIndexOf(String str)
int
lastIndexOf(String str, int fromIndex)
boolean
matches(String regex)
int
offsetByCodePoints(int index, int codePointOffset)
boolean
regionMatches(boolean ignoreCase, int toffset, String other, int ooffset, int len)
boolean
regionMatches(int toffset, String other, int ooffset, int len)
String
replace(char oldChar, char newChar)
String
replace(CharSequence target, CharSequence replacement)
String
replaceAll(String regex, String replacement)
String
replaceFirst(String regex, String replacement)
String[]
split(String regex)
String[]
split(String regex, int limit)
boolean
startsWith(String prefix)
boolean
startsWith(String prefix, int toffset)
String
substring(int beginIndex)
String
substring(int beginIndex, int endIndex)
char[]
toCharArray()
String
toLowerCase()
String
toLowerCase(Locale locale)
String
toUpperCase()
String
toUpperCase(Locale locale)
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
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 partsstrings
- the string parts
-
-
Method Details
-
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 classGString
-
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
-
contentEquals
-
contentEquals
-
equalsIgnoreCase
-
compareTo
-
compareToIgnoreCase
-
regionMatches
-
regionMatches
-
startsWith
-
startsWith
-
endsWith
-
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
-
indexOf
-
lastIndexOf
-
lastIndexOf
-
substring
-
substring
-
concat
-
replace
-
matches
-
contains
-
replaceFirst
-
replaceAll
-
replace
-
split
-
split
-
toLowerCase
-
toLowerCase
-
toUpperCase
-
toUpperCase
-
toCharArray
public char[] toCharArray() -
intern
-