Class UnicodeChar

    • Constructor Detail

      • UnicodeChar

        public UnicodeChar​(int codepoint)
    • Method Detail

      • codePoints

        public IntIterator codePoints()
        Get an iterator over the code points present in the string. Note that this method is always available, whether or not the UnicodeString has been prepared for codePoint access.
        Specified by:
        codePoints in class UnicodeString
        Returns:
        an iterator that delivers the individual code points
      • getCodepoint

        public int getCodepoint()
        Get the codepoint represented by this UnicodeChar
        Returns:
        the relevant codepoint
      • length

        public long length()
        Get the length of the string
        Specified by:
        length in class UnicodeString
        Returns:
        the number of code points in the string
      • getWidth

        public int getWidth()
        Get the number of bits needed to hold all the characters in this string
        Specified by:
        getWidth in class UnicodeString
        Returns:
        7 for ascii characters, 8 for latin-1, 16 for BMP, 24 for general Unicode.
      • indexOf

        public long indexOf​(int codePoint,
                            long from)
        Get the position of the first occurrence of the specified codepoint, starting the search at a given position in the string
        Specified by:
        indexOf in class UnicodeString
        Parameters:
        codePoint - the sought codePoint
        from - the position from which the search should start (0-based)
        Returns:
        the position (0-based) of the first occurrence found, or -1 if not found
      • codePointAt

        public int codePointAt​(long index)
        Get the code point at a given position in the string
        Specified by:
        codePointAt in class UnicodeString
        Parameters:
        index - the given position (0-based)
        Returns:
        the code point at the given position
        Throws:
        java.lang.IndexOutOfBoundsException - if index is not zero
      • substring

        public UnicodeString substring​(long start,
                                       long end)
        Get a substring of this codepoint sequence, with a given start and end position
        Specified by:
        substring in class UnicodeString
        Parameters:
        start - the start position (0-based): that is, the position of the first code point to be included
        end - the end position (0-based): specifically, the position of the first code point not to be included
        Returns:
        the requested substring
        Throws:
        java.lang.IndexOutOfBoundsException - if the start/end positions are out of range
      • indexWhere

        public long indexWhere​(java.util.function.IntPredicate predicate,
                               long from)
        Get the position of the first occurrence of the specified codepoint, starting the search at a given position in the string
        Specified by:
        indexWhere in class UnicodeString
        Parameters:
        predicate - condition that the codepoint must satisfy
        from - the position from which the search should start (0-based)
        Returns:
        the position (0-based) of the first codepoint to match the predicate, or -1 if not found
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object