java.lang.CharSequencepublic class StringContainer
extends java.lang.Object
implements java.lang.CharSequence
| Constructor | Description |
|---|---|
StringContainer() |
| Modifier and Type | Method | Description |
|---|---|---|
int |
capacity() |
Returns the current capacity.
|
char |
charAt(int index) |
Returns the
char value in this sequence at the specified index. |
boolean |
endsWith(java.lang.String suffix) |
Tests if this string ends with the specified suffix.
|
java.lang.CharSequence |
getValue() |
|
boolean |
isEmpty() |
|
int |
length() |
Returns the length (character count).
|
char |
remove(int position) |
|
java.lang.CharSequence |
split(int start) |
Set a new Startposition
|
boolean |
startsWith(java.lang.String prefix) |
Tests if this string starts with the specified prefix.
|
boolean |
startsWith(java.lang.String prefix,
int toffset) |
Tests if the substring of this string beginning at the
specified index starts with the specified prefix.
|
java.lang.CharSequence |
subSequence(int start,
int end) |
Returns a new character sequence that is a subsequence of this sequence.
|
java.lang.CharSequence |
substring(int start) |
Returns a new
String that contains a subsequence of characters
currently contained in this character sequence. |
java.lang.CharSequence |
substring(int start,
int end) |
Returns a new
String that contains a subsequence of characters
currently contained in this sequence. |
java.lang.String |
toString() |
Returns a string representing the data in this sequence.
|
java.lang.CharSequence |
trim() |
|
StringContainer |
with(char src) |
|
StringContainer |
with(java.lang.CharSequence src) |
Relative bulk put method (optional operation).
|
public boolean isEmpty()
true if length() is 0, otherwise falsepublic int length()
length in interface java.lang.CharSequencepublic int capacity()
public java.lang.String toString()
String object is allocated and initialized to contain the
character sequence currently represented by this object. This
String is then returned. Subsequent changes to this sequence do
not affect the contents of the String.toString in interface java.lang.CharSequencetoString in class java.lang.Objectpublic java.lang.CharSequence getValue()
String for the contentEquals method.public java.lang.CharSequence subSequence(int start,
int end)
An invocation of this method of the form
sb.subSequence(begin, end)
behaves in exactly the same way as the invocation
sb.substring(begin, end)
This method is provided so that this class can implement the
CharSequence interface.subSequence in interface java.lang.CharSequencestart - the start index, inclusive.end - the end index, exclusive.public java.lang.CharSequence substring(int start)
String that contains a subsequence of characters
currently contained in this character sequence. The substring begins at
the specified index and extends to the end of this sequence.start - the beginning index, inclusive.public java.lang.CharSequence substring(int start,
int end)
String that contains a subsequence of characters
currently contained in this sequence. The substring begins at the
specified start and extends to the character at index
end - 1.start - the beginning index, inclusive.end - the ending index, exclusive.public java.lang.CharSequence split(int start)
start - The new Start position relativpublic char charAt(int index)
char value in this sequence at the specified index.
The first char value is at index 0, the next at index
1, and so on, as in array indexing.
The index argument must be greater than or equal to 0, and less
than the length of this sequence.
If the char value specified by the index is a
surrogate, the surrogate value is
returned.
charAt in interface java.lang.CharSequenceindex - the index of the desired char value.char value at the specified index.java.lang.IndexOutOfBoundsException - if index is negative or greater than or equal to
length().public boolean endsWith(java.lang.String suffix)
suffix - the suffix.true if the character sequence represented by the
argument is a suffix of the character sequence represented by
this object; false otherwise. Note that the result will
be true if the argument is the empty string or is equal
to this String object as determined by the
Object.equals(Object) method.public boolean startsWith(java.lang.String prefix)
prefix - the prefix.true if the character sequence represented by the
argument is a prefix of the character sequence represented by
this string; false otherwise.
Note also that true will be returned if the
argument is an empty string or is equal to this
String object as determined by the
Object.equals(Object) method.public boolean startsWith(java.lang.String prefix,
int toffset)
prefix - the prefix.toffset - where to begin looking in this string.true if the character sequence represented by the
argument is a prefix of the substring of this object starting
at index toffset; false otherwise.
The result is false if toffset is
negative or greater than the length of this
String object; otherwise the result is the same
as the result of the expression
this.substring(toffset).startsWith(prefix)
public final StringContainer with(java.lang.CharSequence src)
This method transfers the entire content of the given source string into this buffer. An invocation of this method of the form dst.put(s) behaves in exactly the same way as the invocation
dst.put(s, 0, s.length()) src - The source stringjava.nio.BufferOverflowException - If there is insufficient space in this bufferjava.nio.ReadOnlyBufferException - If this buffer is read-onlypublic final StringContainer with(char src)
public char remove(int position)
public java.lang.CharSequence trim()