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.GStringEMPTY, EMPTY_OBJECT_ARRAY, EMPTY_STRING_ARRAY
 
- 
 - 
Constructor SummaryConstructors Constructor Description GStringImpl(Object[] values, String[] strings)Create a new GString with values and strings.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intcodePointAt(int index)intcodePointBefore(int index)intcodePointCount(int beginIndex, int endIndex)intcompareTo(String anotherString)intcompareToIgnoreCase(String str)Stringconcat(String str)booleancontains(CharSequence s)booleancontentEquals(CharSequence cs)booleancontentEquals(StringBuffer sb)booleanendsWith(String suffix)booleanequalsIgnoreCase(String anotherString)byte[]getBytes(Charset charset)voidgetChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)String[]getStrings()Get the strings of this GString.intindexOf(int ch)intindexOf(int ch, int fromIndex)intindexOf(String str)intindexOf(String str, int fromIndex)Stringintern()booleanisEmpty()intlastIndexOf(int ch)intlastIndexOf(int ch, int fromIndex)intlastIndexOf(String str)intlastIndexOf(String str, int fromIndex)booleanmatches(String regex)intoffsetByCodePoints(int index, int codePointOffset)booleanregionMatches(boolean ignoreCase, int toffset, String other, int ooffset, int len)booleanregionMatches(int toffset, String other, int ooffset, int len)Stringreplace(char oldChar, char newChar)Stringreplace(CharSequence target, CharSequence replacement)StringreplaceAll(String regex, String replacement)StringreplaceFirst(String regex, String replacement)String[]split(String regex)String[]split(String regex, int limit)booleanstartsWith(String prefix)booleanstartsWith(String prefix, int toffset)Stringsubstring(int beginIndex)Stringsubstring(int beginIndex, int endIndex)char[]toCharArray()StringtoLowerCase()StringtoLowerCase(Locale locale)StringtoUpperCase()StringtoUpperCase(Locale locale)Stringtrim()- 
Methods inherited from class groovy.lang.GStringbuild, charAt, compareTo, equals, equals, getBytes, getBytes, getValue, getValueCount, getValues, hashCode, invokeMethod, length, negate, plus, plus, subSequence, toString, writeTo
 - 
Methods inherited from class groovy.lang.GroovyObjectSupportgetMetaClass, setMetaClass
 - 
Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface java.lang.CharSequencechars, codePoints
 - 
Methods inherited from interface groovy.lang.GroovyObjectgetProperty, setProperty
 
- 
 
- 
- 
- 
Constructor Detail- 
GStringImplpublic GStringImpl(Object[] values, 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 Detail- 
getStringspublic 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:
- getStringsin class- GString
 
 - 
trimpublic String trim() 
 - 
isEmptypublic boolean isEmpty() 
 - 
codePointAtpublic int codePointAt(int index) 
 - 
codePointBeforepublic int codePointBefore(int index) 
 - 
codePointCountpublic int codePointCount(int beginIndex, int endIndex)
 - 
offsetByCodePointspublic int offsetByCodePoints(int index, int codePointOffset)
 - 
getCharspublic void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
 - 
getBytespublic byte[] getBytes(Charset charset) 
 - 
contentEqualspublic boolean contentEquals(StringBuffer sb) 
 - 
contentEqualspublic boolean contentEquals(CharSequence cs) 
 - 
equalsIgnoreCasepublic boolean equalsIgnoreCase(String anotherString) 
 - 
compareTopublic int compareTo(String anotherString) 
 - 
compareToIgnoreCasepublic int compareToIgnoreCase(String str) 
 - 
regionMatchespublic boolean regionMatches(int toffset, String other, int ooffset, int len)
 - 
regionMatchespublic boolean regionMatches(boolean ignoreCase, int toffset, String other, int ooffset, int len)
 - 
startsWithpublic boolean startsWith(String prefix, int toffset) 
 - 
startsWithpublic boolean startsWith(String prefix) 
 - 
endsWithpublic boolean endsWith(String suffix) 
 - 
indexOfpublic int indexOf(int ch) 
 - 
indexOfpublic int indexOf(int ch, int fromIndex)
 - 
lastIndexOfpublic int lastIndexOf(int ch) 
 - 
lastIndexOfpublic int lastIndexOf(int ch, int fromIndex)
 - 
indexOfpublic int indexOf(String str) 
 - 
indexOfpublic int indexOf(String str, int fromIndex) 
 - 
lastIndexOfpublic int lastIndexOf(String str) 
 - 
lastIndexOfpublic int lastIndexOf(String str, int fromIndex) 
 - 
substringpublic String substring(int beginIndex) 
 - 
substringpublic String substring(int beginIndex, int endIndex) 
 - 
replacepublic String replace(char oldChar, char newChar) 
 - 
matchespublic boolean matches(String regex) 
 - 
containspublic boolean contains(CharSequence s) 
 - 
replacepublic String replace(CharSequence target, CharSequence replacement) 
 - 
toLowerCasepublic String toLowerCase() 
 - 
toUpperCasepublic String toUpperCase() 
 - 
toCharArraypublic char[] toCharArray() 
 - 
internpublic String intern() 
 
- 
 
-