Java™ Platform
Standard Ed. 8
compact1, compact2, compact3
java.text
Class StringCharacterIterator
-
-
Method Summary
All Methods Instance Methods Concrete Methods
| Modifier and Type |
Method |
Description |
Object |
clone() |
Creates a copy of this iterator.
|
char |
current() |
Implements CharacterIterator.current() for String.
|
boolean |
equals(Object obj) |
Compares the equality of two StringCharacterIterator objects.
|
char |
first() |
Implements CharacterIterator.first() for String.
|
int |
getBeginIndex() |
Implements CharacterIterator.getBeginIndex() for String.
|
int |
getEndIndex() |
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 |
setText(String text) |
Reset this iterator to point to a new string.
|
-
-
Constructor Detail
-
StringCharacterIterator
public StringCharacterIterator(String text,
int pos)
Constructs an iterator with the specified initial index.
- Parameters:
text - The String to be iterated over
pos - Initial iterator position
-
StringCharacterIterator
public 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.
- Parameters:
text - The String to be iterated over
begin - Index of the first character
end - Index of the character following the last character
pos - Initial iterator position
-
Method Detail
-
setText
public void setText(String text)
Reset this iterator to point to a new string. This package-visible
method is used by other java.text classes that want to avoid allocating
new StringCharacterIterator objects every time their setText method
is called.
- Parameters:
text - The String to be iterated over
- Since:
- 1.2
Java™ Platform
Standard Ed. 8
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.