![]() |
![]()
![]() ![]() ![]()
![]() |
![]() |
All Packages Class Hierarchy This Package Previous Next Index Interface java.text.CharacterIterator
Examples: Traverse the text from start to finish public void traverseForward(CharacterIterator iter) { for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) { processChar(c); } }Traverse the text backwards, from end to start public void traverseBackward(CharacterIterator iter) { for(char c = iter.last(); c != CharacterIterator.DONE; c = iter.prev()) { processChar(c); } }Traverse both forward and backward from a given position in the text. Calls to notBoundary() in this example represents some additional stopping criteria. public void traverseOut(CharacterIterator iter, int pos) { for (char c = iter.setIndex(pos); c != CharacterIterator.DONE && notBoundary(c); c = iter.next()) {} int end = iter.getIndex(); for (char c = iter.setIndex(pos); c != CharacterIterator.DONE && notBoundary(c); c = iter.prev()) {} int start = iter.getIndex(); processSection(start,end); }
![]() public static final char DONE
![]() public abstract char first()
![]() public abstract char last()
![]() public abstract char current()
![]() public abstract char next()
![]() public abstract char previous()
![]() public abstract char setIndex(int position)
![]() public abstract int getBeginIndex()
![]() public abstract int getEndIndex()
![]() public abstract int getIndex()
![]() public abstract Object clone() All Packages Class Hierarchy This Package Previous Next Index Submit a bug or feature |
||||||||||||||||
With any suggestions or questions please feel free to contact us |