|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.badlogic.gdx.utils.StringBuilder
public class StringBuilder
A StringBuilder
that implements equals and hashcode.
CharSequence
,
Appendable
,
StringBuilder
,
String
Field Summary | |
---|---|
char[] |
chars
|
int |
length
|
Constructor Summary | |
---|---|
StringBuilder()
Constructs an instance with an initial capacity of 16 . |
|
StringBuilder(CharSequence seq)
Constructs an instance that's initialized with the contents of the specified CharSequence . |
|
StringBuilder(int capacity)
Constructs an instance with the specified capacity. |
|
StringBuilder(String string)
Constructs an instance that's initialized with the contents of the specified String . |
|
StringBuilder(StringBuilder builder)
|
Method Summary | |
---|---|
StringBuilder |
append(boolean b)
Appends the string representation of the specified boolean value. |
StringBuilder |
append(char c)
Appends the string representation of the specified char value. |
StringBuilder |
append(char[] ch)
Appends the string representation of the specified char[] . |
StringBuilder |
append(char[] str,
int offset,
int len)
Appends the string representation of the specified subset of the char[] . |
StringBuilder |
append(CharSequence csq)
Appends the string representation of the specified CharSequence . |
StringBuilder |
append(CharSequence csq,
int start,
int end)
Appends the string representation of the specified subsequence of the CharSequence . |
StringBuilder |
append(double d)
Appends the string representation of the specified double value. |
StringBuilder |
append(float f)
Appends the string representation of the specified float value. |
StringBuilder |
append(int i)
Appends the string representation of the specified int value. |
StringBuilder |
append(long lng)
Appends the string representation of the specified long value. |
StringBuilder |
append(Object obj)
Appends the string representation of the specified Object . |
StringBuilder |
append(String str)
Appends the contents of the specified string. |
StringBuilder |
append(StringBuilder builder)
|
StringBuilder |
append(StringBuilder builder,
int start,
int end)
|
StringBuilder |
appendCodePoint(int codePoint)
Appends the encoded Unicode code point. |
int |
capacity()
Returns the number of characters that can be held without growing. |
char |
charAt(int index)
Retrieves the character at the index . |
int |
codePointAt(int index)
Retrieves the Unicode code point value at the index . |
int |
codePointBefore(int index)
Retrieves the Unicode code point value that precedes the index . |
int |
codePointCount(int beginIndex,
int endIndex)
Calculates the number of Unicode code points between beginIndex and endIndex . |
StringBuilder |
delete(int start,
int end)
Deletes a sequence of characters specified by start and end . |
StringBuilder |
deleteCharAt(int index)
Deletes the character at the specified index. |
void |
ensureCapacity(int min)
Ensures that this object has a minimum capacity available before requiring the internal buffer to be enlarged. |
boolean |
equals(Object obj)
|
void |
getChars(int start,
int end,
char[] dest,
int destStart)
Copies the requested sequence of characters to the char[] passed starting at destStart . |
int |
hashCode()
|
int |
indexOf(String string)
Searches for the first index of the specified character. |
int |
indexOf(String subString,
int start)
Searches for the index of the specified character. |
StringBuilder |
insert(int offset,
boolean b)
Inserts the string representation of the specified boolean value at the specified offset . |
StringBuilder |
insert(int offset,
char c)
Inserts the string representation of the specified char value at the specified offset . |
StringBuilder |
insert(int offset,
char[] ch)
Inserts the string representation of the specified char[] at the specified offset . |
StringBuilder |
insert(int offset,
char[] str,
int strOffset,
int strLen)
Inserts the string representation of the specified subsequence of the char[] at the specified offset . |
StringBuilder |
insert(int offset,
CharSequence s)
Inserts the string representation of the specified CharSequence at the specified offset . |
StringBuilder |
insert(int offset,
CharSequence s,
int start,
int end)
Inserts the string representation of the specified subsequence of the CharSequence at the specified offset . |
StringBuilder |
insert(int offset,
double d)
Inserts the string representation of the specified double value at the specified offset . |
StringBuilder |
insert(int offset,
float f)
Inserts the string representation of the specified float value at the specified offset . |
StringBuilder |
insert(int offset,
int i)
Inserts the string representation of the specified int value at the specified offset . |
StringBuilder |
insert(int offset,
long l)
Inserts the string representation of the specified long value at the specified offset . |
StringBuilder |
insert(int offset,
Object obj)
Inserts the string representation of the specified Object at the specified offset . |
StringBuilder |
insert(int offset,
String str)
Inserts the specified string at the specified offset . |
int |
lastIndexOf(String string)
Searches for the last index of the specified character. |
int |
lastIndexOf(String subString,
int start)
Searches for the index of the specified character. |
int |
length()
The current length. |
int |
offsetByCodePoints(int index,
int codePointOffset)
Returns the index that is offset codePointOffset code points from index . |
StringBuilder |
replace(int start,
int end,
String str)
Replaces the specified subsequence in this builder with the specified string. |
StringBuilder |
reverse()
Reverses the order of characters in this builder. |
void |
setCharAt(int index,
char ch)
Sets the character at the index . |
void |
setLength(int newLength)
Sets the current length to a new value. |
CharSequence |
subSequence(int start,
int end)
Returns a CharSequence of the subsequence from the start index to the end index. |
String |
substring(int start)
Returns the String value of the subsequence from the start index to the current end. |
String |
substring(int start,
int end)
Returns the String value of the subsequence from the start index to the end index. |
String |
toString()
Returns the current String representation. |
void |
trimToSize()
Trims off any extra capacity beyond the current length. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public char[] chars
public int length
Constructor Detail |
---|
public StringBuilder()
16
.
capacity()
public StringBuilder(int capacity)
capacity
- the initial capacity to use.
NegativeArraySizeException
- if the specified capacity
is negative.capacity()
public StringBuilder(CharSequence seq)
CharSequence
. The capacity of the new
builder will be the length of the CharSequence
plus 16.
seq
- the CharSequence
to copy into the builder.
NullPointerException
- if seq
is null
.public StringBuilder(StringBuilder builder)
public StringBuilder(String string)
String
. The capacity of the new builder
will be the length of the String
plus 16.
string
- the String
to copy into the builder.
NullPointerException
- if str
is null
.Method Detail |
---|
public int capacity()
ensureCapacity(int)
,
length
public char charAt(int index)
index
.
charAt
in interface CharSequence
index
- the index of the character to retrieve.
IndexOutOfBoundsException
- if index
is negative or greater than or equal to the current length()
.public void ensureCapacity(int min)
minimumCapacity
is larger than the current capacity()
, then the
capacity will be increased to the largest value of either the minimumCapacity
or the current capacity multiplied by
two plus two. Although this is the general policy, there is no guarantee that the capacity will change.
min
- the new minimum capacity to set.public void getChars(int start, int end, char[] dest, int destStart)
char[]
passed starting at destStart
.
start
- the inclusive start index of the characters to copy.end
- the exclusive end index of the characters to copy.dest
- the char[]
to copy the characters to.destStart
- the inclusive start index of dest
to begin copying to.
IndexOutOfBoundsException
- if the start
is negative, the destStart
is negative, the start
is
greater than end
, the end
is greater than the current length()
or
destStart + end - begin
is greater than dest.length
.public int length()
length
in interface CharSequence
public void setCharAt(int index, char ch)
index
.
index
- the zero-based index of the character to replace.ch
- the character to set.
IndexOutOfBoundsException
- if index
is negative or greater than or equal to the current length()
.public void setLength(int newLength)
char
value of