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 startthroughend - 1from this CharSequence intodestbeginning at offsetdestoff. | 
  
| Inherited methods | 
|---|
| 
    From interface
      
        
          java.lang.CharSequence
        
      
      
  
  
  
    | 
        abstract
        
        
        
        
        char | 
      charAt(int index)
      Returns the charvalue at the specified index. |  
  
  
    | 
        
        default
        
        
        
        IntStream | 
      chars()
      Returns a stream of intzero-extending thecharvalues
 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 CharSequenceinstances lexicographically. |  
  
  
    | 
        
        default
        
        
        
        boolean | 
      isEmpty()
      Returns trueif this character sequence is empty. |  
  
  
    | 
        abstract
        
        
        
        
        int | 
      length()
      Returns the length of this character sequence.
        
    
 |  
  
  
    | 
        abstract
        
        
        
        
        CharSequence | 
      subSequence(int start, int end)
      Returns a CharSequencethat 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."],[],[]]