java.text.StringCharacterIterator
java.lang.Object
None
java.text.CharacterIterator
New as of JDK 1.1
The StringCharacterIterator class can move bidirectionally through a character string. In other words, the class iterates through the characters in a String. The class implements the CharacterIterator interface. The class is used by BreakIterator to find boundaries in text strings.
public final class java.text.StringCharacterIterator extends java.lang.Object implements java.text.CharacterIterator { // Constructors public StringCharacterIterator(String text); public StringCharacterIterator(String text, int pos); public StringCharacterIterator(String text, int begin, int end, int pos); // Instance Methods public Object clone(); public char current(); public boolean equals(Object obj); public char first(); public int getBeginIndex(); public int getEndIndex(); public int getIndex(); public int hashCode(); public char last(); public char next(); public char previous(); public char setIndex(int p); }
The String to use.
This constructor creates a StringCharacterIterator that uses the given string. The initial index of the iterator is at the beginning of the string, or in other words, at index 0.
The String to use.
The initial position.
This constructor creates a StringCharacterIterator that uses the given string. The initial index of the iterator is set to the given initial position.
public StringCharacterIterator(String text, int begin, int end, int pos)
The String to use.
The beginning index.
The ending index.
The initial position.
This constructor creates a StringCharacterIterator that uses the specified range of the given string. In other words, the iterator uses the sequence of text from the specified beginning index to the specified ending index. The initial index of the iterator is set to the given initial position.
A copy of this StringCharacterIterator.
CharacterIterator.clone()
Object.clone()
This method creates a copy of this StringCharacterIterator and returns it.
The character at the current position of this StringCharacterIterator or DONE if the current position is not within the text sequence.
CharacterIterator.current()
This method returns the character at the current position of this CharacterIterator. The current position is returned by getIndex().
The object to be compared with this object.
true if the objects are equal; false if they are not.
Object.equals()
This method returns true if obj is an instance of StringCharacterIterator and is equivalent to this StringCharacterIterator.
The first character in this StringCharacterIterator.
CharacterIterator.first()
This method returns the character at the first position in this StringCharacterIterator. The first position is returned by getBeginIndex(). The current position of the iterator is set to this position.
The index of the first character in this StringCharacterIterator.
CharacterIterator.getBeginIndex()
This method returns the index of the beginning of the text for this StringCharacterIterator.
The index after the last character in this StringCharacterIterator.
CharacterIterator.getEndIndex()
This method returns the index of the character following the end of the text for this StringCharacterIterator.
The index of the current character in this StringCharacterIterator.
This method returns the current position, or index, of this StringCharacterIterator.
A hashcode for this object.
Object.hashCode()
This method returns a hashcode for this StringCharacterIterator.
The last character in this StringCharacterIterator.
CharacterIterator.last()
This method returns the character at the ending position of this StringCharacterIterator. The last position is the value of getEndIndex()-1. The current position of the iterator is set to this position.
The next character in this StringCharacterIterator or DONE if the current position is already at the end of the text.
CharacterIterator.next()
This method increments the current position of this StringCharacterIterator by 1 and returns the character at the new position. If the current position is already at getEndIndex(), the position is not changed and DONE is returned.
The previous character in this StringCharacterIterator or DONE if the current position is already at the beginning of the text.
CharacterIterator.previous()
This method decrements the current position of this StringCharacterIterator by 1 and returns the character at the new position. If the current position is already at getBeginIndex(), the position is not changed and DONE is returned.
The new position.
The character at the specified position in this StringCharacterIterator.
If the given position is not between getBeginIndex() and getEndIndex()-1.
CharacterIterator.setIndex()
This method sets the current position, or index, of this StringCharacterIterator to the given position.
Method | Inherited From | Method | Inherited From |
---|---|---|---|
finalize() |
Object |
getClass() |
Object |
notify() |
Object |
notifyAll() |
Object |
toString() |
Object |
wait() |
Object |
wait(long) |
Object |
wait(long, int) |
Object |
BreakIterator, CharacterIterator, String
This HTML Help has been published using the chm2web software. |