Class CodePointUtil


  • public final class CodePointUtil
    extends java.lang.Object
    Contains utility methods for code point.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private CodePointUtil()
      Stop instances being created.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean endsWith​(int[] codePoints, java.lang.String suffix)
      Tests if the unicode code points array ends with the specified suffix.
      static boolean hasWhitespaceBefore​(int index, int... codePoints)
      Checks if the given code point array contains only whitespace up to specified index.
      static boolean isBlank​(int... codePoints)
      Checks if given code point array is blank by either being empty, or contains only whitespace characters.
      static int[] stripLeading​(int... codePoints)
      Removes leading whitespaces.
      static int[] stripTrailing​(int... codePoints)
      Removes trailing whitespaces.
      static int[] trim​(int... codePoints)
      Removes leading and trailing whitespaces.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CodePointUtil

        private CodePointUtil()
        Stop instances being created.
    • Method Detail

      • isBlank

        public static boolean isBlank​(int... codePoints)
        Checks if given code point array is blank by either being empty, or contains only whitespace characters.
        Parameters:
        codePoints - The array of unicode code points of string to check.
        Returns:
        true if codePoints is blank.
      • hasWhitespaceBefore

        public static boolean hasWhitespaceBefore​(int index,
                                                  int... codePoints)
        Checks if the given code point array contains only whitespace up to specified index.
        Parameters:
        codePoints - array of Unicode code point of string to check
        index - index to check up to (exclusive)
        Returns:
        true if all code points preceding given index are whitespace
      • stripTrailing

        public static int[] stripTrailing​(int... codePoints)
        Removes trailing whitespaces.
        Parameters:
        codePoints - array of unicode code points
        Returns:
        unicode code points array with trailing whitespaces removed
      • stripLeading

        public static int[] stripLeading​(int... codePoints)
        Removes leading whitespaces.
        Parameters:
        codePoints - array of unicode code points
        Returns:
        unicode code points array with leading whitespaces removed
      • trim

        public static int[] trim​(int... codePoints)
        Removes leading and trailing whitespaces.
        Parameters:
        codePoints - array of unicode code points
        Returns:
        unicode code points array with leading and trailing whitespaces removed
      • endsWith

        public static boolean endsWith​(int[] codePoints,
                                       java.lang.String suffix)
        Tests if the unicode code points array ends with the specified suffix.
        Parameters:
        suffix - the suffix
        codePoints - the array of unicode code points to check
        Returns:
        true, if the unicode code points array ends with provided suffix