Skip to content

Most visited

Recently visited

navigation
Added in API level 1

AlteredCharSequence

public class AlteredCharSequence
extends Object implements CharSequence, GetChars

java.lang.Object
   ↳ android.text.AlteredCharSequence


An AlteredCharSequence is a CharSequence that is largely mirrored from another CharSequence, except that a specified range of characters are mirrored from a different char array instead.

Summary

Public methods

char charAt(int off)

Returns the character at index.

void getChars(int start, int end, char[] dest, int off)

Exactly like String.getChars(): copy chars start through end - 1 from this CharSequence into dest beginning at offset destoff.

int length()

Returns the number of characters in this sequence.

static AlteredCharSequence make(CharSequence source, char[] sub, int substart, int subend)

Create an AlteredCharSequence whose text (and possibly spans) are mirrored from source, except that the range of offsets substart inclusive to subend exclusive are mirrored instead from sub, beginning at offset 0.

CharSequence subSequence(int start, int end)

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

String toString()

Returns a string containing a concise, human-readable description of this object.

Inherited methods

From class java.lang.Object
From interface java.lang.CharSequence
From interface android.text.GetChars

Public methods

charAt

Added in API level 1
char charAt (int off)

Returns the character at index.

Parameters
off int
Returns
char

getChars

Added in API level 1
void getChars (int start, 
                int end, 
                char[] dest, 
                int off)

Exactly like String.getChars(): copy chars start through end - 1 from this CharSequence into dest beginning at offset destoff.

Parameters
start int
end int
dest char
off int

length

Added in API level 1
int length ()

Returns the number of characters in this sequence.

Returns
int the number of characters.

make

Added in API level 1
AlteredCharSequence make (CharSequence source, 
                char[] sub, 
                int substart, 
                int subend)

Create an AlteredCharSequence whose text (and possibly spans) are mirrored from source, except that the range of offsets substart inclusive to subend exclusive are mirrored instead from sub, beginning at offset 0.

Parameters
source CharSequence
sub char
substart int
subend int
Returns
AlteredCharSequence

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.

toString

Added in API level 1
String toString ()

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
String a printable representation of this object.
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.