加载中...
The Wayback Machine - https://sup1a9wrlpyh5li9ro.vcoronado.top/web/20090226230130/http://developer.android.com:80/reference/java/text/CharacterIterator.html
public interface

CharacterIterator

implements Cloneable
java.text.CharacterIterator
Known Indirect Subclasses

Class Overview

CharacterIterator is used to sequence over a group of characters. The iteration starts at the begin index in the group of character and continues to one index before the end index.

Summary

Constants
char DONE A constant which indicates there is no character.
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 begin index.
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 current 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.

Constants

public static final char DONE

A constant which indicates there is no character.

Constant Value: 65535 (0x0000ffff)

Public Methods

public abstract Object clone ()

Returns a new CharacterIterator with the same properties.

Returns
  • a shallow copy of this CharacterIterator
See Also

public abstract char current ()

Returns the character at the current index.

Returns
  • the current character, or DONE if the current index is past the end

public abstract char first ()

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

Returns
  • the character at the begin index

public abstract int getBeginIndex ()

Returns the begin index.

Returns
  • the index of the first character to iterate

public abstract int getEndIndex ()

Returns the end index.

Returns
  • the index one past the last character to iterate

public abstract int getIndex ()

Returns the current index.

Returns
  • the current index

public abstract char last ()

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

Returns
  • the character before the end index

public abstract char next ()

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 is past the end

public abstract char previous ()

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 is past the beginning

public abstract char setIndex (int location)

Sets the current index.

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