Class TextUtils


  • public final class TextUtils
    extends Object

    Utility class for char[] operations (mainly matching/comparing)

    Since:
    3.0.0
    Author:
    Daniel Fernández
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int binarySearch​(boolean caseSensitive, char[][] values, char[] text, int textOffset, int textLen)
      Searches the specified array of texts (values) for the specified text —or a fragment, using an (offset,len) specification— using the binary search algorithm.
      static int binarySearch​(boolean caseSensitive, char[][] values, int valuesOffset, int valuesLen, char[] text, int textOffset, int textLen)
      Searches the specified array of texts (values) for the specified text —or a fragment, using an (offset,len) specification— using the binary search algorithm.
      static int binarySearch​(boolean caseSensitive, char[][] values, int valuesOffset, int valuesLen, CharSequence text, int textOffset, int textLen)
      Searches the specified array of texts (values) for the specified text —or a fragment, using an (offset,len) specification— using the binary search algorithm.
      static int binarySearch​(boolean caseSensitive, char[][] values, CharSequence text, int textOffset, int textLen)
      Searches the specified array of texts (values) for the specified text —or a fragment, using an (offset,len) specification— using the binary search algorithm.
      static int binarySearch​(boolean caseSensitive, CharSequence[] values, char[] text, int textOffset, int textLen)
      Searches the specified array of texts (values) for the specified text —or a fragment, using an (offset,len) specification— using the binary search algorithm.
      static int binarySearch​(boolean caseSensitive, CharSequence[] values, int valuesOffset, int valuesLen, char[] text, int textOffset, int textLen)
      Searches the specified array of texts (values) for the specified text —or a fragment, using an (offset,len) specification— using the binary search algorithm.
      static int binarySearch​(boolean caseSensitive, CharSequence[] values, int valuesOffset, int valuesLen, CharSequence text, int textOffset, int textLen)
      Searches the specified array of texts (values) for the specified text —or a fragment, using an (offset,len) specification— using the binary search algorithm.
      static int binarySearch​(boolean caseSensitive, CharSequence[] values, CharSequence text, int textOffset, int textLen)
      Searches the specified array of texts (values) for the specified text —or a fragment, using an (offset,len) specification— using the binary search algorithm.
      static int compareTo​(boolean caseSensitive, char[] text1, char[] text2)
      Compares two texts lexicographically.
      static int compareTo​(boolean caseSensitive, char[] text1, int text1Offset, int text1Len, char[] text2, int text2Offset, int text2Len)
      Compares two texts lexicographically.
      static int compareTo​(boolean caseSensitive, CharSequence text1, char[] text2)
      Compares two texts lexicographically.
      static int compareTo​(boolean caseSensitive, CharSequence text1, int text1Offset, int text1Len, char[] text2, int text2Offset, int text2Len)
      Compares two texts lexicographically.
      static int compareTo​(boolean caseSensitive, CharSequence text1, int text1Offset, int text1Len, CharSequence text2, int text2Offset, int text2Len)
      Compares two texts lexicographically.
      static int compareTo​(boolean caseSensitive, CharSequence text1, CharSequence text2)
      Compares two texts lexicographically.
      static boolean contains​(boolean caseSensitive, char[] text, char[] fragment)
      Checks whether a text contains a specific fragment.
      static boolean contains​(boolean caseSensitive, char[] text, int textOffset, int textLen, char[] fragment, int fragmentOffset, int fragmentLen)
      Checks whether a text contains a specific fragment, specifying (offset,len) pairs for limiting the fragments to be checked.
      static boolean contains​(boolean caseSensitive, char[] text, int textOffset, int textLen, CharSequence fragment, int fragmentOffset, int fragmentLen)
      Checks whether a text contains a specific fragment, specifying (offset,len) pairs for limiting the fragments to be checked.
      static boolean contains​(boolean caseSensitive, CharSequence text, char[] fragment)
      Checks whether a text contains a specific fragment.
      static boolean contains​(boolean caseSensitive, CharSequence text, int textOffset, int textLen, char[] fragment, int fragmentOffset, int fragmentLen)
      Checks whether a text contains a specific fragment, specifying (offset,len) pairs for limiting the fragments to be checked.
      static boolean contains​(boolean caseSensitive, CharSequence text, int textOffset, int textLen, CharSequence fragment, int fragmentOffset, int fragmentLen)
      Checks whether a text contains a specific fragment, specifying (offset,len) pairs for limiting the fragments to be checked.
      static boolean contains​(boolean caseSensitive, CharSequence text, CharSequence fragment)
      Checks whether a text contains a specific fragment.
      static boolean endsWith​(boolean caseSensitive, char[] text, char[] suffix)
      Checks whether a text ends with a specified suffix.
      static boolean endsWith​(boolean caseSensitive, char[] text, int textOffset, int textLen, char[] suffix, int suffixOffset, int suffixLen)
      Checks whether a text ends with a specified suffix, specifying (offset,len) pairs for limiting the fragments to be checked.
      static boolean endsWith​(boolean caseSensitive, char[] text, int textOffset, int textLen, CharSequence suffix, int suffixOffset, int suffixLen)
      Checks whether a text ends with a specified suffix, specifying (offset,len) pairs for limiting the fragments to be checked.
      static boolean endsWith​(boolean caseSensitive, CharSequence text, char[] suffix)
      Checks whether a text ends with a specified suffix.
      static boolean endsWith​(boolean caseSensitive, CharSequence text, int textOffset, int textLen, char[] suffix, int suffixOffset, int suffixLen)
      Checks whether a text ends with a specified suffix, specifying (offset,len) pairs for limiting the fragments to be checked.
      static boolean endsWith​(boolean caseSensitive, CharSequence text, int textOffset, int textLen, CharSequence suffix, int suffixOffset, int suffixLen)
      Checks whether a text ends with a specified suffix, specifying (offset,len) pairs for limiting the fragments to be checked.
      static boolean endsWith​(boolean caseSensitive, CharSequence text, CharSequence suffix)
      Checks whether a text ends with a specified suffix.
      static boolean equals​(boolean caseSensitive, char[] text1, char[] text2)
      Check equality between two char[] objects.
      static boolean equals​(boolean caseSensitive, char[] text1, int text1Offset, int text1Len, char[] text2, int text2Offset, int text2Len)
      Check equality between two char[] objects, specifying (offset,len) pairs for limiting the fragments to be checked.
      static boolean equals​(boolean caseSensitive, CharSequence text1, char[] text2)
      Check equality between a CharSequence and a char[] object.
      static boolean equals​(boolean caseSensitive, CharSequence text1, int text1Offset, int text1Len, char[] text2, int text2Offset, int text2Len)
      Check equality between a CharSequence and a char[] object, specifying (offset,len) pairs for limiting the fragments to be checked.
      static boolean equals​(boolean caseSensitive, CharSequence text1, int text1Offset, int text1Len, CharSequence text2, int text2Offset, int text2Len)
      Check equality between two CharSequence objects, specifying (offset,len) pairs for limiting the fragments to be checked.
      static boolean equals​(boolean caseSensitive, CharSequence text1, CharSequence text2)
      Check equality of two CharSequence objects.
      static int hashCode​(char[] text, int textOffset, int textLen)  
      static int hashCode​(CharSequence text)  
      static int hashCode​(CharSequence text, int beginIndex, int endIndex)  
      static int hashCode​(CharSequence text0, CharSequence text1)  
      static int hashCode​(CharSequence text0, CharSequence text1, CharSequence text2)  
      static int hashCode​(CharSequence text0, CharSequence text1, CharSequence text2, CharSequence text3)  
      static int hashCode​(CharSequence text0, CharSequence text1, CharSequence text2, CharSequence text3, CharSequence text4)  
      static boolean startsWith​(boolean caseSensitive, char[] text, char[] prefix)
      Checks whether a text starts with a specified prefix.
      static boolean startsWith​(boolean caseSensitive, char[] text, int textOffset, int textLen, char[] prefix, int prefixOffset, int prefixLen)
      Checks whether a text starts with a specified prefix, specifying (offset,len) pairs for limiting the fragments to be checked.
      static boolean startsWith​(boolean caseSensitive, char[] text, int textOffset, int textLen, CharSequence prefix, int prefixOffset, int prefixLen)
      Checks whether a text starts with a specified prefix, specifying (offset,len) pairs for limiting the fragments to be checked.
      static boolean startsWith​(boolean caseSensitive, CharSequence text, char[] prefix)
      Checks whether a text starts with a specified prefix.
      static boolean startsWith​(boolean caseSensitive, CharSequence text, int textOffset, int textLen, char[] prefix, int prefixOffset, int prefixLen)
      Checks whether a text starts with a specified prefix, specifying (offset,len) pairs for limiting the fragments to be checked.
      static boolean startsWith​(boolean caseSensitive, CharSequence text, int textOffset, int textLen, CharSequence prefix, int prefixOffset, int prefixLen)
      Checks whether a text starts with a specified prefix, specifying (offset,len) pairs for limiting the fragments to be checked.
      static boolean startsWith​(boolean caseSensitive, CharSequence text, CharSequence prefix)
      Checks whether a text starts with a specified prefix.
    • Method Detail

      • equals

        public static boolean equals​(boolean caseSensitive,
                                     CharSequence text1,
                                     CharSequence text2)

        Check equality of two CharSequence objects. This is equivalent to String.equals(Object) and String.equalsIgnoreCase(String).

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text1 - the first text to be compared.
        text2 - the second text to be compared.
        Returns:
        whether both texts are equal or not.
      • equals

        public static boolean equals​(boolean caseSensitive,
                                     CharSequence text1,
                                     char[] text2)

        Check equality between a CharSequence and a char[] object.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text1 - the first text to be compared.
        text2 - the second text to be compared.
        Returns:
        whether both texts are equal or not.
      • equals

        public static boolean equals​(boolean caseSensitive,
                                     char[] text1,
                                     char[] text2)

        Check equality between two char[] objects.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text1 - the first text to be compared.
        text2 - the second text to be compared.
        Returns:
        whether both texts are equal or not.
      • equals

        public static boolean equals​(boolean caseSensitive,
                                     char[] text1,
                                     int text1Offset,
                                     int text1Len,
                                     char[] text2,
                                     int text2Offset,
                                     int text2Len)

        Check equality between two char[] objects, specifying (offset,len) pairs for limiting the fragments to be checked.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text1 - the first text to be compared.
        text1Offset - the offset of the first text.
        text1Len - the length of the first text.
        text2 - the second text to be compared.
        text2Offset - the offset of the second text.
        text2Len - the length of the second text.
        Returns:
        whether both texts are equal or not.
      • equals

        public static boolean equals​(boolean caseSensitive,
                                     CharSequence text1,
                                     int text1Offset,
                                     int text1Len,
                                     char[] text2,
                                     int text2Offset,
                                     int text2Len)

        Check equality between a CharSequence and a char[] object, specifying (offset,len) pairs for limiting the fragments to be checked.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text1 - the first text to be compared.
        text1Offset - the offset of the first text.
        text1Len - the length of the first text.
        text2 - the second text to be compared.
        text2Offset - the offset of the second text.
        text2Len - the length of the second text.
        Returns:
        whether both texts are equal or not.
      • equals

        public static boolean equals​(boolean caseSensitive,
                                     CharSequence text1,
                                     int text1Offset,
                                     int text1Len,
                                     CharSequence text2,
                                     int text2Offset,
                                     int text2Len)

        Check equality between two CharSequence objects, specifying (offset,len) pairs for limiting the fragments to be checked.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text1 - the first text to be compared.
        text1Offset - the offset of the first text.
        text1Len - the length of the first text.
        text2 - the second text to be compared.
        text2Offset - the offset of the second text.
        text2Len - the length of the second text.
        Returns:
        whether both texts are equal or not.
      • startsWith

        public static boolean startsWith​(boolean caseSensitive,
                                         CharSequence text,
                                         CharSequence prefix)

        Checks whether a text starts with a specified prefix.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for prefixes.
        prefix - the prefix to be searched.
        Returns:
        whether the text starts with the prefix or not.
      • startsWith

        public static boolean startsWith​(boolean caseSensitive,
                                         CharSequence text,
                                         char[] prefix)

        Checks whether a text starts with a specified prefix.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for prefixes.
        prefix - the prefix to be searched.
        Returns:
        whether the text starts with the prefix or not.
      • startsWith

        public static boolean startsWith​(boolean caseSensitive,
                                         char[] text,
                                         char[] prefix)

        Checks whether a text starts with a specified prefix.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for prefixes.
        prefix - the prefix to be searched.
        Returns:
        whether the text starts with the prefix or not.
      • startsWith

        public static boolean startsWith​(boolean caseSensitive,
                                         char[] text,
                                         int textOffset,
                                         int textLen,
                                         char[] prefix,
                                         int prefixOffset,
                                         int prefixLen)

        Checks whether a text starts with a specified prefix, specifying (offset,len) pairs for limiting the fragments to be checked.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for prefixes.
        textOffset - the offset of the text.
        textLen - the length of the text.
        prefix - the prefix to be searched.
        prefixOffset - the offset of the prefix.
        prefixLen - the length of the prefix.
        Returns:
        whether the text starts with the prefix or not.
      • startsWith

        public static boolean startsWith​(boolean caseSensitive,
                                         CharSequence text,
                                         int textOffset,
                                         int textLen,
                                         char[] prefix,
                                         int prefixOffset,
                                         int prefixLen)

        Checks whether a text starts with a specified prefix, specifying (offset,len) pairs for limiting the fragments to be checked.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for prefixes.
        textOffset - the offset of the text.
        textLen - the length of the text.
        prefix - the prefix to be searched.
        prefixOffset - the offset of the prefix.
        prefixLen - the length of the prefix.
        Returns:
        whether the text starts with the prefix or not.
      • startsWith

        public static boolean startsWith​(boolean caseSensitive,
                                         char[] text,
                                         int textOffset,
                                         int textLen,
                                         CharSequence prefix,
                                         int prefixOffset,
                                         int prefixLen)

        Checks whether a text starts with a specified prefix, specifying (offset,len) pairs for limiting the fragments to be checked.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for prefixes.
        textOffset - the offset of the text.
        textLen - the length of the text.
        prefix - the prefix to be searched.
        prefixOffset - the offset of the prefix.
        prefixLen - the length of the prefix.
        Returns:
        whether the text starts with the prefix or not.
      • startsWith

        public static boolean startsWith​(boolean caseSensitive,
                                         CharSequence text,
                                         int textOffset,
                                         int textLen,
                                         CharSequence prefix,
                                         int prefixOffset,
                                         int prefixLen)

        Checks whether a text starts with a specified prefix, specifying (offset,len) pairs for limiting the fragments to be checked.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for prefixes.
        textOffset - the offset of the text.
        textLen - the length of the text.
        prefix - the prefix to be searched.
        prefixOffset - the offset of the prefix.
        prefixLen - the length of the prefix.
        Returns:
        whether the text starts with the prefix or not.
      • endsWith

        public static boolean endsWith​(boolean caseSensitive,
                                       CharSequence text,
                                       CharSequence suffix)

        Checks whether a text ends with a specified suffix.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for suffixes.
        suffix - the suffix to be searched.
        Returns:
        whether the text ends with the suffix or not.
      • endsWith

        public static boolean endsWith​(boolean caseSensitive,
                                       CharSequence text,
                                       char[] suffix)

        Checks whether a text ends with a specified suffix.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for suffixes.
        suffix - the suffix to be searched.
        Returns:
        whether the text ends with the suffix or not.
      • endsWith

        public static boolean endsWith​(boolean caseSensitive,
                                       char[] text,
                                       char[] suffix)

        Checks whether a text ends with a specified suffix.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for suffixes.
        suffix - the suffix to be searched.
        Returns:
        whether the text ends with the suffix or not.
      • endsWith

        public static boolean endsWith​(boolean caseSensitive,
                                       char[] text,
                                       int textOffset,
                                       int textLen,
                                       char[] suffix,
                                       int suffixOffset,
                                       int suffixLen)

        Checks whether a text ends with a specified suffix, specifying (offset,len) pairs for limiting the fragments to be checked.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for suffixes.
        textOffset - the offset of the text.
        textLen - the length of the text.
        suffix - the suffix to be searched.
        suffixOffset - the offset of the suffix.
        suffixLen - the length of the suffix.
        Returns:
        whether the text ends with the suffix or not.
      • endsWith

        public static boolean endsWith​(boolean caseSensitive,
                                       CharSequence text,
                                       int textOffset,
                                       int textLen,
                                       char[] suffix,
                                       int suffixOffset,
                                       int suffixLen)

        Checks whether a text ends with a specified suffix, specifying (offset,len) pairs for limiting the fragments to be checked.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for suffixes.
        textOffset - the offset of the text.
        textLen - the length of the text.
        suffix - the suffix to be searched.
        suffixOffset - the offset of the suffix.
        suffixLen - the length of the suffix.
        Returns:
        whether the text ends with the suffix or not.
      • endsWith

        public static boolean endsWith​(boolean caseSensitive,
                                       char[] text,
                                       int textOffset,
                                       int textLen,
                                       CharSequence suffix,
                                       int suffixOffset,
                                       int suffixLen)

        Checks whether a text ends with a specified suffix, specifying (offset,len) pairs for limiting the fragments to be checked.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for suffixes.
        textOffset - the offset of the text.
        textLen - the length of the text.
        suffix - the suffix to be searched.
        suffixOffset - the offset of the suffix.
        suffixLen - the length of the suffix.
        Returns:
        whether the text ends with the suffix or not.
      • endsWith

        public static boolean endsWith​(boolean caseSensitive,
                                       CharSequence text,
                                       int textOffset,
                                       int textLen,
                                       CharSequence suffix,
                                       int suffixOffset,
                                       int suffixLen)

        Checks whether a text ends with a specified suffix, specifying (offset,len) pairs for limiting the fragments to be checked.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for suffixes.
        textOffset - the offset of the text.
        textLen - the length of the text.
        suffix - the suffix to be searched.
        suffixOffset - the offset of the suffix.
        suffixLen - the length of the suffix.
        Returns:
        whether the text ends with the suffix or not.
      • contains

        public static boolean contains​(boolean caseSensitive,
                                       CharSequence text,
                                       CharSequence fragment)

        Checks whether a text contains a specific fragment.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for fragments.
        fragment - the fragment to be searched.
        Returns:
        whether the text contains the fragment or not.
      • contains

        public static boolean contains​(boolean caseSensitive,
                                       CharSequence text,
                                       char[] fragment)

        Checks whether a text contains a specific fragment.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for fragments.
        fragment - the fragment to be searched.
        Returns:
        whether the text contains the fragment or not.
      • contains

        public static boolean contains​(boolean caseSensitive,
                                       char[] text,
                                       char[] fragment)

        Checks whether a text contains a specific fragment.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for fragments.
        fragment - the fragment to be searched.
        Returns:
        whether the text contains the fragment or not.
      • contains

        public static boolean contains​(boolean caseSensitive,
                                       char[] text,
                                       int textOffset,
                                       int textLen,
                                       char[] fragment,
                                       int fragmentOffset,
                                       int fragmentLen)

        Checks whether a text contains a specific fragment, specifying (offset,len) pairs for limiting the fragments to be checked.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for fragments.
        textOffset - the offset of the text.
        textLen - the length of the text.
        fragment - the fragment to be searched.
        fragmentOffset - the offset of the fragment.
        fragmentLen - the length of the fragment.
        Returns:
        whether the text contains the fragment or not.
      • contains

        public static boolean contains​(boolean caseSensitive,
                                       CharSequence text,
                                       int textOffset,
                                       int textLen,
                                       char[] fragment,
                                       int fragmentOffset,
                                       int fragmentLen)

        Checks whether a text contains a specific fragment, specifying (offset,len) pairs for limiting the fragments to be checked.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for fragments.
        textOffset - the offset of the text.
        textLen - the length of the text.
        fragment - the fragment to be searched.
        fragmentOffset - the offset of the fragment.
        fragmentLen - the length of the fragment.
        Returns:
        whether the text contains the fragment or not.
      • contains

        public static boolean contains​(boolean caseSensitive,
                                       char[] text,
                                       int textOffset,
                                       int textLen,
                                       CharSequence fragment,
                                       int fragmentOffset,
                                       int fragmentLen)

        Checks whether a text contains a specific fragment, specifying (offset,len) pairs for limiting the fragments to be checked.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for fragments.
        textOffset - the offset of the text.
        textLen - the length of the text.
        fragment - the fragment to be searched.
        fragmentOffset - the offset of the fragment.
        fragmentLen - the length of the fragment.
        Returns:
        whether the text contains the fragment or not.
      • contains

        public static boolean contains​(boolean caseSensitive,
                                       CharSequence text,
                                       int textOffset,
                                       int textLen,
                                       CharSequence fragment,
                                       int fragmentOffset,
                                       int fragmentLen)

        Checks whether a text contains a specific fragment, specifying (offset,len) pairs for limiting the fragments to be checked.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text - the text to be checked for fragments.
        textOffset - the offset of the text.
        textLen - the length of the text.
        fragment - the fragment to be searched.
        fragmentOffset - the offset of the fragment.
        fragmentLen - the length of the fragment.
        Returns:
        whether the text contains the fragment or not.
      • compareTo

        public static int compareTo​(boolean caseSensitive,
                                    CharSequence text1,
                                    CharSequence text2)

        Compares two texts lexicographically.

        The comparison is based on the Unicode value of each character in the CharSequences. The character sequence represented by the first text object is compared lexicographically to the character sequence represented by the second text.

        The result is a negative integer if the first text lexicographically precedes the second text. The result is a positive integer if the first text lexicographically follows the second text. The result is zero if the texts are equal.

        This method works in a way equivalent to that of the String.compareTo(String) and String.compareToIgnoreCase(String) methods.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text1 - the first text to be compared.
        text2 - the second text to be compared.
        Returns:
        the value 0 if both texts are equal; a value less than 0 if the first text is lexicographically less than the second text; and a value greater than 0 if the first text is lexicographically greater than the second text.
      • compareTo

        public static int compareTo​(boolean caseSensitive,
                                    CharSequence text1,
                                    char[] text2)

        Compares two texts lexicographically.

        The comparison is based on the Unicode value of each character in the CharSequences. The character sequence represented by the first text object is compared lexicographically to the character sequence represented by the second text.

        The result is a negative integer if the first text lexicographically precedes the second text. The result is a positive integer if the first text lexicographically follows the second text. The result is zero if the texts are equal.

        This method works in a way equivalent to that of the String.compareTo(String) and String.compareToIgnoreCase(String) methods.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text1 - the first text to be compared.
        text2 - the second text to be compared.
        Returns:
        the value 0 if both texts are equal; a value less than 0 if the first text is lexicographically less than the second text; and a value greater than 0 if the first text is lexicographically greater than the second text.
      • compareTo

        public static int compareTo​(boolean caseSensitive,
                                    char[] text1,
                                    char[] text2)

        Compares two texts lexicographically.

        The comparison is based on the Unicode value of each character in the CharSequences. The character sequence represented by the first text object is compared lexicographically to the character sequence represented by the second text.

        The result is a negative integer if the first text lexicographically precedes the second text. The result is a positive integer if the first text lexicographically follows the second text. The result is zero if the texts are equal.

        This method works in a way equivalent to that of the String.compareTo(String) and String.compareToIgnoreCase(String) methods.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text1 - the first text to be compared.
        text2 - the second text to be compared.
        Returns:
        the value 0 if both texts are equal; a value less than 0 if the first text is lexicographically less than the second text; and a value greater than 0 if the first text is lexicographically greater than the second text.
      • compareTo

        public static int compareTo​(boolean caseSensitive,
                                    char[] text1,
                                    int text1Offset,
                                    int text1Len,
                                    char[] text2,
                                    int text2Offset,
                                    int text2Len)

        Compares two texts lexicographically.

        The comparison is based on the Unicode value of each character in the CharSequences. The character sequence represented by the first text object is compared lexicographically to the character sequence represented by the second text.

        The result is a negative integer if the first text lexicographically precedes the second text. The result is a positive integer if the first text lexicographically follows the second text. The result is zero if the texts are equal.

        This method works in a way equivalent to that of the String.compareTo(String) and String.compareToIgnoreCase(String) methods.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text1 - the first text to be compared.
        text1Offset - the offset of the first text.
        text1Len - the length of the first text.
        text2 - the second text to be compared.
        text2Offset - the offset of the second text.
        text2Len - the length of the second text.
        Returns:
        the value 0 if both texts are equal; a value less than 0 if the first text is lexicographically less than the second text; and a value greater than 0 if the first text is lexicographically greater than the second text.
      • compareTo

        public static int compareTo​(boolean caseSensitive,
                                    CharSequence text1,
                                    int text1Offset,
                                    int text1Len,
                                    char[] text2,
                                    int text2Offset,
                                    int text2Len)

        Compares two texts lexicographically.

        The comparison is based on the Unicode value of each character in the CharSequences. The character sequence represented by the first text object is compared lexicographically to the character sequence represented by the second text.

        The result is a negative integer if the first text lexicographically precedes the second text. The result is a positive integer if the first text lexicographically follows the second text. The result is zero if the texts are equal.

        This method works in a way equivalent to that of the String.compareTo(String) and String.compareToIgnoreCase(String) methods.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text1 - the first text to be compared.
        text1Offset - the offset of the first text.
        text1Len - the length of the first text.
        text2 - the second text to be compared.
        text2Offset - the offset of the second text.
        text2Len - the length of the second text.
        Returns:
        the value 0 if both texts are equal; a value less than 0 if the first text is lexicographically less than the second text; and a value greater than 0 if the first text is lexicographically greater than the second text.
      • compareTo

        public static int compareTo​(boolean caseSensitive,
                                    CharSequence text1,
                                    int text1Offset,
                                    int text1Len,
                                    CharSequence text2,
                                    int text2Offset,
                                    int text2Len)

        Compares two texts lexicographically.

        The comparison is based on the Unicode value of each character in the CharSequences. The character sequence represented by the first text object is compared lexicographically to the character sequence represented by the second text.

        The result is a negative integer if the first text lexicographically precedes the second text. The result is a positive integer if the first text lexicographically follows the second text. The result is zero if the texts are equal.

        This method works in a way equivalent to that of the String.compareTo(String) and String.compareToIgnoreCase(String) methods.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        text1 - the first text to be compared.
        text1Offset - the offset of the first text.
        text1Len - the length of the first text.
        text2 - the second text to be compared.
        text2Offset - the offset of the second text.
        text2Len - the length of the second text.
        Returns:
        the value 0 if both texts are equal; a value less than 0 if the first text is lexicographically less than the second text; and a value greater than 0 if the first text is lexicographically greater than the second text.
      • binarySearch

        public static int binarySearch​(boolean caseSensitive,
                                       char[][] values,
                                       char[] text,
                                       int textOffset,
                                       int textLen)

        Searches the specified array of texts (values) for the specified text —or a fragment, using an (offset,len) specification— using the binary search algorithm.

        Note the specified values parameter must be lexicographically ordered.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        values - the array of texts inside which the specified text will be searched. Note that it must be ordered.
        text - the text to search.
        textOffset - the offset of the text to search.
        textLen - the length of the text to search.
        Returns:
        index of the search key, if it is contained in the values array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array. Note that this guarantees that the return value will be >= 0 if and only if the key is found.
      • binarySearch

        public static int binarySearch​(boolean caseSensitive,
                                       char[][] values,
                                       CharSequence text,
                                       int textOffset,
                                       int textLen)

        Searches the specified array of texts (values) for the specified text —or a fragment, using an (offset,len) specification— using the binary search algorithm.

        Note the specified values parameter must be lexicographically ordered.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        values - the array of texts inside which the specified text will be searched. Note that it must be ordered.
        text - the text to search.
        textOffset - the offset of the text to search.
        textLen - the length of the text to search.
        Returns:
        index of the search key, if it is contained in the values array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array. Note that this guarantees that the return value will be >= 0 if and only if the key is found.
      • binarySearch

        public static int binarySearch​(boolean caseSensitive,
                                       CharSequence[] values,
                                       char[] text,
                                       int textOffset,
                                       int textLen)

        Searches the specified array of texts (values) for the specified text —or a fragment, using an (offset,len) specification— using the binary search algorithm.

        Note the specified values parameter must be lexicographically ordered.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        values - the array of texts inside which the specified text will be searched. Note that it must be ordered.
        text - the text to search.
        textOffset - the offset of the text to search.
        textLen - the length of the text to search.
        Returns:
        index of the search key, if it is contained in the values array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array. Note that this guarantees that the return value will be >= 0 if and only if the key is found.
      • binarySearch

        public static int binarySearch​(boolean caseSensitive,
                                       CharSequence[] values,
                                       CharSequence text,
                                       int textOffset,
                                       int textLen)

        Searches the specified array of texts (values) for the specified text —or a fragment, using an (offset,len) specification— using the binary search algorithm.

        Note the specified values parameter must be lexicographically ordered.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        values - the array of texts inside which the specified text will be searched. Note that it must be ordered.
        text - the text to search.
        textOffset - the offset of the text to search.
        textLen - the length of the text to search.
        Returns:
        index of the search key, if it is contained in the values array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array. Note that this guarantees that the return value will be >= 0 if and only if the key is found.
      • binarySearch

        public static int binarySearch​(boolean caseSensitive,
                                       char[][] values,
                                       int valuesOffset,
                                       int valuesLen,
                                       char[] text,
                                       int textOffset,
                                       int textLen)

        Searches the specified array of texts (values) for the specified text —or a fragment, using an (offset,len) specification— using the binary search algorithm.

        Note the specified values parameter must be lexicographically ordered.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        values - the array of texts inside which the specified text will be searched. Note that it must be ordered.
        valuesOffset - the offset to be applied to the texts array so that search only takes part in a fragment of it.
        valuesLen - the length of the fragment of the texts array in which search will take part.
        text - the text to search.
        textOffset - the offset of the text to search.
        textLen - the length of the text to search.
        Returns:
        index of the search key, if it is contained in the values array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array. Note that this guarantees that the return value will be >= 0 if and only if the key is found.
      • binarySearch

        public static int binarySearch​(boolean caseSensitive,
                                       char[][] values,
                                       int valuesOffset,
                                       int valuesLen,
                                       CharSequence text,
                                       int textOffset,
                                       int textLen)

        Searches the specified array of texts (values) for the specified text —or a fragment, using an (offset,len) specification— using the binary search algorithm.

        Note the specified values parameter must be lexicographically ordered.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        values - the array of texts inside which the specified text will be searched. Note that it must be ordered.
        valuesOffset - the offset to be applied to the texts array so that search only takes part in a fragment of it.
        valuesLen - the length of the fragment of the texts array in which search will take part.
        text - the text to search.
        textOffset - the offset of the text to search.
        textLen - the length of the text to search.
        Returns:
        index of the search key, if it is contained in the values array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array. Note that this guarantees that the return value will be >= 0 if and only if the key is found.
      • binarySearch

        public static int binarySearch​(boolean caseSensitive,
                                       CharSequence[] values,
                                       int valuesOffset,
                                       int valuesLen,
                                       char[] text,
                                       int textOffset,
                                       int textLen)

        Searches the specified array of texts (values) for the specified text —or a fragment, using an (offset,len) specification— using the binary search algorithm.

        Note the specified values parameter must be lexicographically ordered.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        values - the array of texts inside which the specified text will be searched. Note that it must be ordered.
        valuesOffset - the offset to be applied to the texts array so that search only takes part in a fragment of it.
        valuesLen - the length of the fragment of the texts array in which search will take part.
        text - the text to search.
        textOffset - the offset of the text to search.
        textLen - the length of the text to search.
        Returns:
        index of the search key, if it is contained in the values array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array. Note that this guarantees that the return value will be >= 0 if and only if the key is found.
      • binarySearch

        public static int binarySearch​(boolean caseSensitive,
                                       CharSequence[] values,
                                       int valuesOffset,
                                       int valuesLen,
                                       CharSequence text,
                                       int textOffset,
                                       int textLen)

        Searches the specified array of texts (values) for the specified text —or a fragment, using an (offset,len) specification— using the binary search algorithm.

        Note the specified values parameter must be lexicographically ordered.

        Parameters:
        caseSensitive - whether the comparison must be done in a case-sensitive or case-insensitive way.
        values - the array of texts inside which the specified text will be searched. Note that it must be ordered.
        valuesOffset - the offset to be applied to the texts array so that search only takes part in a fragment of it.
        valuesLen - the length of the fragment of the texts array in which search will take part.
        text - the text to search.
        textOffset - the offset of the text to search.
        textLen - the length of the text to search.
        Returns:
        index of the search key, if it is contained in the values array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array. Note that this guarantees that the return value will be >= 0 if and only if the key is found.
      • hashCode

        public static int hashCode​(char[] text,
                                   int textOffset,
                                   int textLen)
      • hashCode

        public static int hashCode​(CharSequence text)
      • hashCode

        public static int hashCode​(CharSequence text,
                                   int beginIndex,
                                   int endIndex)