# AlteredCharSequence

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Methods](https://developer.android.com/reference/android/text/AlteredCharSequence#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/text/AlteredCharSequence#inhmethods)  

# AlteredCharSequence

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/text/AlteredCharSequence "View this page in Kotlin")\|Java

`
public


class
AlteredCharSequence
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


implements

`[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)`,

`[GetChars](https://developer.android.com/reference/android/text/GetChars)`


`

|---|----------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.text.AlteredCharSequence |

<br />

*** ** * ** ***

<br />

**This class was deprecated in API level 30.**   
The functionality this class offers is easily implemented outside the framework.

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](https://developer.android.com/reference/android/text/AlteredCharSequence#charAt(int))`(int off) ` Returns the`char`value at the specified index.                                                                                                                                                                                                                                                                                                                                       |
| ` void`                                                                                                   | ` `[getChars](https://developer.android.com/reference/android/text/AlteredCharSequence#getChars(int,%20int,%20char[],%20int))`(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](https://developer.android.com/reference/android/text/AlteredCharSequence#length())`() ` Returns the length of this character sequence.                                                                                                                                                                                                                                                                                                                                                 |
| ` static `[AlteredCharSequence](https://developer.android.com/reference/android/text/AlteredCharSequence) | ` `[make](https://developer.android.com/reference/android/text/AlteredCharSequence#make(java.lang.CharSequence,%20char[],%20int,%20int))`(`[CharSequence](https://developer.android.com/reference/java/lang/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](https://developer.android.com/reference/java/lang/CharSequence)                         | ` `[subSequence](https://developer.android.com/reference/android/text/AlteredCharSequence#subSequence(int,%20int))`(int start, int end) ` Returns a`CharSequence`that is a subsequence of this sequence.                                                                                                                                                                                                                                                                                           |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                     | ` `[toString](https://developer.android.com/reference/android/text/AlteredCharSequence#toString())`() ` Returns a string representation of the object.                                                                                                                                                                                                                                                                                                                                             |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||
| From interface` `[java.lang.CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` ` |--------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract char`                                                                           | ` `[charAt](https://developer.android.com/reference/java/lang/CharSequence#charAt(int))`(int index) ` Returns the`char`value at the specified index.                                                                                                                                                                                                                         | | ` default `[IntStream](https://developer.android.com/reference/java/util/stream/IntStream) | ` `[chars](https://developer.android.com/reference/java/lang/CharSequence#chars())`() ` Returns a stream of`int`zero-extending the`char`values from this sequence.                                                                                                                                                                                                           | | ` default `[IntStream](https://developer.android.com/reference/java/util/stream/IntStream) | ` `[codePoints](https://developer.android.com/reference/java/lang/CharSequence#codePoints())`() ` Returns a stream of code point values from this sequence.                                                                                                                                                                                                                  | | ` static int`                                                                              | ` `[compare](https://developer.android.com/reference/java/lang/CharSequence#compare(java.lang.CharSequence,%20java.lang.CharSequence))`(`[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` cs1, `[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` cs2) ` Compares two`CharSequence`instances lexicographically. | | ` default boolean`                                                                         | ` `[isEmpty](https://developer.android.com/reference/java/lang/CharSequence#isEmpty())`() ` Returns`true`if this character sequence is empty.                                                                                                                                                                                                                                | | ` abstract int`                                                                            | ` `[length](https://developer.android.com/reference/java/lang/CharSequence#length())`() ` Returns the length of this character sequence.                                                                                                                                                                                                                                     | | ` abstract `[CharSequence](https://developer.android.com/reference/java/lang/CharSequence) | ` `[subSequence](https://developer.android.com/reference/java/lang/CharSequence#subSequence(int,%20int))`(int start, int end) ` Returns a`CharSequence`that is a subsequence of this sequence.                                                                                                                                                                               | | ` abstract `[String](https://developer.android.com/reference/java/lang/String)             | ` `[toString](https://developer.android.com/reference/java/lang/CharSequence#toString())`() ` Returns a string containing the characters in this sequence in the same order as this sequence.                                                                                                                                                                                | ||
| From interface` `[android.text.GetChars](https://developer.android.com/reference/android/text/GetChars)` ` |------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[getChars](https://developer.android.com/reference/android/text/GetChars#getChars(int,%20int,%20char[],%20int))`(int start, int end, char[] dest, int destoff) ` Exactly like String.getChars(): copy chars`start`through`end - 1`from this CharSequence into`dest`beginning at offset`destoff`. | ||

## Public methods

### charAt

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public char charAt (int off)
```

Returns the`char`value at the specified index. An index ranges from zero to`length() - 1`. The first`char`value of the sequence is at index zero, the next at index one, and so on, as for array indexing.

If the`char`value specified by the index is a[surrogate](https://reference/java/lang/Character.html#unicode), the surrogate value is returned.

<br />

|                           Parameters                            ||
|-------|----------------------------------------------------------|
| `off` | `int`: the index of the`char`value to be returned <br /> |

|                 Returns                 ||
|--------|---------------------------------|
| `char` | the specified`char`value <br /> |

### getChars

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public 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`.

<br />

|       Parameters       ||
|---------|---------------|
| `start` | `int` <br />  |
| `end`   | `int` <br />  |
| `dest`  | `char` <br /> |
| `off`   | `int` <br />  |

### length

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int length ()
```

Returns the length of this character sequence. The length is the number of 16-bit`char`s in the sequence.

<br />

|                       Returns                       ||
|-------|----------------------------------------------|
| `int` | the number of`char`s in this sequence <br /> |

### make

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public 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.

<br />

|            Parameters             ||
|------------|-----------------------|
| `source`   | `CharSequence` <br /> |
| `sub`      | `char` <br />         |
| `substart` | `int` <br />          |
| `subend`   | `int` <br />          |

|                                                 Returns                                                 ||
|-------------------------------------------------------------------------------------------------|--------|
| [AlteredCharSequence](https://developer.android.com/reference/android/text/AlteredCharSequence) | <br /> |

### subSequence

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CharSequence subSequence (int start, 
                int end)
```

Returns a`CharSequence`that is a subsequence of this sequence. The subsequence starts with the`char`value at the specified index and ends with the`char`value at index`end - 1`. The length (in`char`s) of the returned sequence is`end - start`, so if`start == end`then an empty sequence is returned.

<br />

|                    Parameters                     ||
|---------|------------------------------------------|
| `start` | `int`: the start index, inclusive <br /> |
| `end`   | `int`: the end index, exclusive <br />   |

|                                                     Returns                                                      ||
|--------------------------------------------------------------------------------|----------------------------------|
| [CharSequence](https://developer.android.com/reference/java/lang/CharSequence) | the specified subsequence <br /> |

### toString

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String toString ()
```

Returns a string representation of the object.

<br />

|                                                      Returns                                                      ||
|--------------------------------------------------------------------|-----------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | a string representation of the object. <br /> |