Class EmptyString

  • All Implemented Interfaces:
    java.lang.CharSequence, java.lang.Comparable<UnicodeString>, AtomicMatchKey

    public final class EmptyString
    extends UnicodeString
    An implementation of UnicodeString representing a zero-length string. This is a singleton class with only one instance.
    • Field Detail

      • THE_INSTANCE

        public static final EmptyString THE_INSTANCE
    • Method Detail

      • uSubstring

        public EmptyString uSubstring​(int beginIndex,
                                      int endIndex)
        Description copied from class: UnicodeString
        Get a substring of this string
        Specified by:
        uSubstring in class UnicodeString
        Parameters:
        beginIndex - the index of the first character to be included (counting codepoints, not 16-bit characters)
        endIndex - the index of the first character to be NOT included (counting codepoints, not 16-bit characters)
        Returns:
        a substring
      • uCharAt

        public int uCharAt​(int pos)
        Description copied from class: UnicodeString
        Get the character at a specified position
        Specified by:
        uCharAt in class UnicodeString
        Parameters:
        pos - the index of the required character (counting codepoints, not 16-bit characters)
        Returns:
        a character (Unicode codepoint) at the specified position.
      • uIndexOf

        public int uIndexOf​(int search,
                            int pos)
        Description copied from class: UnicodeString
        Get the first match for a given character
        Specified by:
        uIndexOf in class UnicodeString
        Parameters:
        search - the character to look for
        pos - the first position to look
        Returns:
        the position of the first occurrence of the sought character, or -1 if not found
      • uLength

        public int uLength()
        Description copied from class: UnicodeString
        Get the length of the string, in Unicode codepoints
        Specified by:
        uLength in class UnicodeString
        Returns:
        the number of codepoints in the string
      • isEnd

        public boolean isEnd​(int pos)
        Description copied from class: UnicodeString
        Ask whether a given position is at (or beyond) the end of the string
        Specified by:
        isEnd in class UnicodeString
        Parameters:
        pos - the index of the required character (counting codepoints, not 16-bit characters)
        Returns:
        true iff if the specified index is after the end of the character stream
      • toString

        public java.lang.String toString()
        Specified by:
        toString in interface java.lang.CharSequence
        Overrides:
        toString in class java.lang.Object
      • length

        public int length()
      • charAt

        public char charAt​(int index)
      • subSequence

        public java.lang.CharSequence subSequence​(int start,
                                                  int end)