This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


java.text
class StringCharacterIterator

java.lang.Object extended by java.text.StringCharacterIterator
All Implemented Interfaces:
CharacterIterator

Most common way to construct:

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.

          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

          Creates a copy of this iterator.
 char

          Implements CharacterIterator.current() for String.
 boolean

          Compares the equality of two StringCharacterIterator objects.
 char

          Implements CharacterIterator.first() for String.
 int

          Implements CharacterIterator.getBeginIndex() for String.
 int

          Implements CharacterIterator.getEndIndex() for String.
 int

          Implements CharacterIterator.getIndex() for String.
 int

          Computes a hashcode for this iterator.
 char

          Implements CharacterIterator.last() for String.
 char

          Implements CharacterIterator.next() for String.
 char

          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

StringCharacterIterator

public StringCharacterIterator(String text)
Constructs an iterator with an initial index of 0.

Parameters:
text

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

clone

public Object clone()
Creates a copy of this iterator.

Overrides:
clone in class Object
Returns:
A copy of this

current

public char current()
Implements CharacterIterator.current() for String.


equals

public boolean equals(Object obj)
Compares the equality of two StringCharacterIterator objects.

Overrides:
equals in class Object
Parameters:
obj - the StringCharacterIterator object to be compared with.
Returns:
true if the given obj is the same as this StringCharacterIterator object; false otherwise.

first

public char first()
Implements CharacterIterator.first() for String.


getBeginIndex

public int getBeginIndex()
Implements CharacterIterator.getBeginIndex() for String.


getEndIndex

public int getEndIndex()
Implements CharacterIterator.getEndIndex() for String.


getIndex

public int getIndex()
Implements CharacterIterator.getIndex() for String.


hashCode

public int hashCode()
Computes a hashcode for this iterator.

Overrides:
hashCode in class Object
Returns:
A hash code

last

public char last()
Implements CharacterIterator.last() for String.


next

public char next()
Implements CharacterIterator.next() for String.


previous

public char previous()
Implements CharacterIterator.previous() for String.


setIndex

public char setIndex(int p)
Implements CharacterIterator.setIndex() for String.

Parameters:
p

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


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.