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

CharSequence

java.lang.CharSequence
Known Indirect Subclasses

Class Overview

This interface represents an ordered set of characters and defines the methods to probe them.

Summary

Public Methods
abstract char charAt (int index)
Returns the character at index .
abstract int length ()
Returns the number of characters in this sequence.
abstract CharSequence subSequence (int start, int end)
Returns a CharSequence from the start index (inclusive) to the end index (exclusive) of this sequence.
abstract String toString ()
Returns a string with the same characters in the same order as in this sequence.

Public Methods

public abstract char charAt (int index)

Added in API level 1

Returns the character at index .

Throws
IndexOutOfBoundsException if index < 0 or index >= length() .

public abstract int length ()

Added in API level 1

Returns the number of characters in this sequence.

Returns
  • the number of characters.

public abstract CharSequence subSequence (int start, int end)

Added in API level 1

Returns a CharSequence from the start index (inclusive) to the end index (exclusive) of this sequence.

Parameters
start the start offset of the sub-sequence. It is inclusive, that is, the index of the first character that is included in the sub-sequence.
end the end offset of the sub-sequence. It is exclusive, that is, the index of the first character after those that are included in the sub-sequence
Returns
  • the requested sub-sequence.
Throws
IndexOutOfBoundsException if start < 0 , end < 0 , start > end , or if start or end are greater than the length of this sequence.

public abstract String toString ()

Added in API level 1

Returns a string with the same characters in the same order as in this sequence.

Returns
  • a string based on this sequence.