Stay organized with collections
Save and categorize content based on your preferences.
GetChars
public
interface
GetChars
implements
CharSequence
Known indirect subclasses
AlteredCharSequence |
This class was deprecated
in API level 30.
The functionality this class offers is easily implemented outside the framework.
|
Editable |
This is the interface for text whose content and markup
can be changed (as opposed
to immutable text like Strings).
|
SpannableString |
This is the class for text whose content is immutable but to which
markup objects can be attached and detached.
|
SpannableStringBuilder |
This is the class for text whose content and markup can both be changed.
|
SpannedString |
This is the class for text whose content and markup are immutable.
|
|
Please implement this interface if your CharSequence has a
getChars() method like the one in String that is faster than
calling charAt() multiple times.
Summary
Public methods |
abstract
void
|
getChars(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 .
|
Inherited methods |
From interface
java.lang.CharSequence
abstract
char
|
charAt(int index)
Returns the char value at the specified index.
|
default
IntStream
|
chars()
Returns a stream of int zero-extending the char values
from this sequence.
|
default
IntStream
|
codePoints()
Returns a stream of code point values from this sequence.
|
static
int
|
compare(CharSequence cs1, CharSequence cs2)
Compares two CharSequence instances lexicographically.
|
default
boolean
|
isEmpty()
Returns true if this character sequence is empty.
|
abstract
int
|
length()
Returns the length of this character sequence.
|
abstract
CharSequence
|
subSequence(int start, int end)
Returns a CharSequence that is a subsequence of this sequence.
|
abstract
String
|
toString()
Returns a string containing the characters in this sequence in the same
order as this sequence.
|
|
Public methods
getChars
public abstract void getChars (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
.
Parameters |
start |
int |
end |
int |
dest |
char |
destoff |
int |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# GetChars\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nGetChars\n========\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/text/GetChars \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\n\n\ninterface\nGetChars\n`\n\n\n`\n\n\nimplements\n\n`[CharSequence](/reference/java/lang/CharSequence)`\n\n\n`\n\n|-----------------------|\n| android.text.GetChars |\n\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known indirect subclasses [AlteredCharSequence](/reference/android/text/AlteredCharSequence), [Editable](/reference/android/text/Editable), [SpannableString](/reference/android/text/SpannableString), [SpannableStringBuilder](/reference/android/text/SpannableStringBuilder), [SpannedString](/reference/android/text/SpannedString) |--------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------| | [AlteredCharSequence](/reference/android/text/AlteredCharSequence) | *This class was deprecated in API level 30. The functionality this class offers is easily implemented outside the framework.* | | [Editable](/reference/android/text/Editable) | This is the interface for text whose content and markup can be changed (as opposed to immutable text like Strings). | | [SpannableString](/reference/android/text/SpannableString) | This is the class for text whose content is immutable but to which markup objects can be attached and detached. | | [SpannableStringBuilder](/reference/android/text/SpannableStringBuilder) | This is the class for text whose content and markup can both be changed. | | [SpannedString](/reference/android/text/SpannedString) | This is the class for text whose content and markup are immutable. | |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nPlease implement this interface if your CharSequence has a\ngetChars() method like the one in String that is faster than\ncalling charAt() multiple times.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[getChars](/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`. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From interface ` `[java.lang.CharSequence](/reference/java/lang/CharSequence)` ` |---------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract char` | ` `[charAt](/reference/java/lang/CharSequence#charAt(int))`(int index) ` Returns the `char` value at the specified index. | | ` default `[IntStream](/reference/java/util/stream/IntStream) | ` `[chars](/reference/java/lang/CharSequence#chars())`() ` Returns a stream of `int` zero-extending the `char` values from this sequence. | | ` default `[IntStream](/reference/java/util/stream/IntStream) | ` `[codePoints](/reference/java/lang/CharSequence#codePoints())`() ` Returns a stream of code point values from this sequence. | | ` static int` | ` `[compare](/reference/java/lang/CharSequence#compare(java.lang.CharSequence,%20java.lang.CharSequence))`(`[CharSequence](/reference/java/lang/CharSequence)` cs1, `[CharSequence](/reference/java/lang/CharSequence)` cs2) ` Compares two `CharSequence` instances lexicographically. | | ` default boolean` | ` `[isEmpty](/reference/java/lang/CharSequence#isEmpty())`() ` Returns `true` if this character sequence is empty. | | ` abstract int` | ` `[length](/reference/java/lang/CharSequence#length())`() ` Returns the length of this character sequence. | | ` abstract `[CharSequence](/reference/java/lang/CharSequence) | ` `[subSequence](/reference/java/lang/CharSequence#subSequence(int,%20int))`(int start, int end) ` Returns a `CharSequence` that is a subsequence of this sequence. | | ` abstract `[String](/reference/java/lang/String) | ` `[toString](/reference/java/lang/CharSequence#toString())`() ` Returns a string containing the characters in this sequence in the same order as this sequence. | ||\n\nPublic methods\n--------------\n\n### getChars\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void getChars (int start, \n int end, \n char[] dest, \n int destoff)\n```\n\nExactly like String.getChars(): copy chars `start`\nthrough `end - 1` from this CharSequence into `dest`\nbeginning at offset `destoff`.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------|---------------|\n| `start` | `int` \u003cbr /\u003e |\n| `end` | `int` \u003cbr /\u003e |\n| `dest` | `char` \u003cbr /\u003e |\n| `destoff` | `int` \u003cbr /\u003e |"]]