Package java.lang

Interface CharSequence

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      char charAt​(int index)
      Returns the character at index.
      int length()
      Returns the number of characters in this sequence.
      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 with the same characters in the same order as in this sequence.
    • Method Detail

      • length

        int length()
        Returns the number of characters in this sequence.
        Returns:
        the number of characters.
      • charAt

        char charAt​(int index)
        Returns the character at index.
        Throws:
        IndexOutOfBoundsException - if index < 0 or index >= length().
      • subSequence

        CharSequence subSequence​(int start,
                                 int end)
        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.
        Throws:
        IndexOutOfBoundsException - if start < 0, end < 0, start > end, or if start or end are greater than the length of this sequence.
      • toString

        String toString()
        Returns a string with the same characters in the same order as in this sequence.
        Overrides:
        toString in class Object
        Returns:
        a string based on this sequence.