| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
String s = …;
StringCharacterIterator iterator = new StringCharacterIterator(s);
Based on 59 examples
public final class StringCharacterIterator extends Object implements CharacterIterator
StringCharacterIterator
implements the
CharacterIterater
protocol for a String
.
The StringCharacterIterator
class iterates over the
entire String
.
Constructor Summary | |
---|---|
Constructs an iterator with an initial index of 0. |
|
StringCharacterIterator(String text, int pos) Constructs an iterator with the specified initial index. |
|
StringCharacterIterator(String text, int begin, int end, int pos) Constructs an iterator over the given range of the given string, with the index set at the specified position. |
Method Summary | |
---|---|
Object |
clone() Creates a copy of this iterator. |
char |
current() Implements CharacterIterator.current() for String. |
boolean |
Compares the equality of two StringCharacterIterator objects. |
char |
first() Implements CharacterIterator.first() for String. |
int |
Implements CharacterIterator.getBeginIndex() for String. |
int |
Implements CharacterIterator.getEndIndex() for String. |
int |
getIndex() Implements CharacterIterator.getIndex() for String. |
int |
hashCode() Computes a hashcode for this iterator. |
char |
last() Implements CharacterIterator.last() for String. |
char |
next() Implements CharacterIterator.next() for String. |
char |
previous() Implements CharacterIterator.previous() for String. |
char |
setIndex(int p) Implements CharacterIterator.setIndex() for String. |
void |
Reset this iterator to point to a new string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StringCharacterIterator(String text)
text
public StringCharacterIterator(String text, int pos)
text
- The String to be iterated overpos
- Initial iterator positionpublic StringCharacterIterator(String text, int begin, int end, int pos)
text
- The String to be iterated overbegin
- Index of the first characterend
- Index of the character following the last characterpos
- Initial iterator positionMethod Detail |
---|
public Object clone()
clone
in class Object
public char current()
public boolean equals(Object obj)
equals
in class Object
obj
- the StringCharacterIterator object to be compared with.public char first()
public int getBeginIndex()
public int getEndIndex()
public int getIndex()
public int hashCode()
hashCode
in class Object
public char last()
public char next()
public char previous()
public char setIndex(int p)
p
public void setText(String text)
text
- The String to be iterated over
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |