Skip to content

Most visited

Recently visited

navigation
Added in API level 1

CharSequence

public interface CharSequence

java.lang.CharSequence
Known Indirect Subclasses


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

charAt

Added in API level 1
char charAt (int index)

Returns the character at index.

Parameters
index int
Returns
char
Throws
IndexOutOfBoundsException if index < 0 or index >= length().

length

Added in API level 1
int length ()

Returns the number of characters in this sequence.

Returns
int the number of characters.

subSequence

Added in API level 1
CharSequence subSequence (int start, 
                int end)

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

Parameters
start int: 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 int: 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
CharSequence 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.

toString

Added in API level 1
String toString ()

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

Returns
String a string based on this sequence.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.