public class

AlteredCharSequence

extends Object
implements GetChars CharSequence
java.lang.Object
   ↳ android.text.AlteredCharSequence

Class Overview

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 the specified index, with the first character having index zero.
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.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.text.GetChars
From interface java.lang.CharSequence

Public Methods

public char charAt (int off)

Since: API Level 1

Returns the character at the specified index, with the first character having index zero.

Parameters
off the index of the character to return.
Returns
  • the requested character.

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

Since: API Level 1

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

public int length ()

Since: API Level 1

Returns the number of characters in this sequence.

Returns
  • the number of characters.

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

Since: API Level 1

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.

public CharSequence subSequence (int start, int end)

Since: 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.

public String toString ()

Since: API Level 1

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 simply concatenates the class name, the '@' sign and a hexadecimal representation of the object's hashCode(), that is, it is equivalent to the following expression:

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

Returns
  • a printable representation of this object.