Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public interface

CharacterIterator

implements Cloneable
java.text.CharacterIterator
Known Indirect Subclasses

Class Overview

An interface for the bidirectional iteration over a group of characters. The iteration starts at the begin index in the group of characters and continues to one index before the end index.

Summary

Constants
char DONE A constant which indicates that there is no character at the current index.
Public Methods
abstract Object clone ()
Returns a new CharacterIterator with the same properties.
abstract char current ()
Returns the character at the current index.
abstract char first ()
Sets the current position to the begin index and returns the character at the new position.
abstract int getBeginIndex ()
Returns the begin index.
abstract int getEndIndex ()
Returns the end index.
abstract int getIndex ()
Returns the current index.
abstract char last ()
Sets the current position to the end index - 1 and returns the character at the new position.
abstract char next ()
Increments the current index and returns the character at the new index.
abstract char previous ()
Decrements the current index and returns the character at the new index.
abstract char setIndex (int location)
Sets the current index to a new position and returns the character at the new index.

Constants

public static final char DONE

Added in API level 1

A constant which indicates that there is no character at the current index.

Constant Value: 65535 (0x0000ffff)

Public Methods

public abstract Object clone ()

Added in API level 1

Returns a new CharacterIterator with the same properties.

Returns
  • a shallow copy of this character iterator.
See Also

public abstract char current ()

Added in API level 1

Returns the character at the current index.

Returns
  • the current character, or DONE if the current index is past the beginning or end of the sequence.

public abstract char first ()

Added in API level 1

Sets the current position to the begin index and returns the character at the new position.

Returns
  • the character at the begin index.

public abstract int getBeginIndex ()

Added in API level 1

Returns the begin index.

Returns
  • the index of the first character of the iteration.

public abstract int getEndIndex ()

Added in API level 1

Returns the end index.

Returns
  • the index one past the last character of the iteration.

public abstract int getIndex ()

Added in API level 1

Returns the current index.

Returns
  • the current index.

public abstract char last ()

Added in API level 1

Sets the current position to the end index - 1 and returns the character at the new position.

Returns
  • the character before the end index.

public abstract char next ()

Added in API level 1

Increments the current index and returns the character at the new index.

Returns
  • the character at the next index, or DONE if the next index would be past the end.

public abstract char previous ()

Added in API level 1

Decrements the current index and returns the character at the new index.

Returns
  • the character at the previous index, or DONE if the previous index would be past the beginning.

public abstract char setIndex (int location)

Added in API level 1

Sets the current index to a new position and returns the character at the new index.

Parameters
location the new index that this character iterator is set to.
Returns
  • the character at the new index, or DONE if the index is past the end.
Throws
IllegalArgumentException if location is less than the begin index or greater than the end index.