Class StringUtils


  • public final class StringUtils
    extends Object
    Utilities for string management.
    Since:
    0.6.0
    Version:
    $Id: StringUtils.java 16154 2012-07-14 16:34:05Z colin $
    Author:
    tlerios@marketcetera.com
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private StringUtils()
      Constructor.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static String fromUCP​(int ucp)
      Returns a string containing a single character, namely the given Unicode code point.
      static String fromUCP​(int[] ucps)
      Returns a string containing the characters with the given Unicode code points.
      static boolean isValid​(int ucp)
      Checks whether the given integer represents a well-defined unicode code point that is also not an ISO control character or within the surrogate areas (high or low).
      static int lengthUCP​(String s)
      Returns the number of Unicode code points in the given string.
      static int[] toUCPArray​(String s)
      Returns an array containing the Unicode code points of the given string.
      static String toUCPArrayStr​(String s)
      Returns a string containing the integer representations, in uppercase hex, of the Unicode code points of the given string.
    • Constructor Detail

      • StringUtils

        private StringUtils()
        Constructor. It is private so that no instances can be created.
    • Method Detail

      • lengthUCP

        public static int lengthUCP​(String s)
        Returns the number of Unicode code points in the given string.
        Parameters:
        s - The string.
        Returns:
        The number of Unicode code points.
      • fromUCP

        public static String fromUCP​(int[] ucps)
        Returns a string containing the characters with the given Unicode code points.
        Parameters:
        ucps - The code points.
        Returns:
        The string.
      • fromUCP

        public static String fromUCP​(int ucp)
        Returns a string containing a single character, namely the given Unicode code point.
        Parameters:
        ucp - The code point.
        Returns:
        The string.
      • toUCPArray

        public static int[] toUCPArray​(String s)
        Returns an array containing the Unicode code points of the given string.
        Parameters:
        s - The string. It may be null, in which case null is returned.
        Returns:
        The code points.
      • toUCPArrayStr

        public static String toUCPArrayStr​(String s)
        Returns a string containing the integer representations, in uppercase hex, of the Unicode code points of the given string.
        Parameters:
        s - The input string. It may be null, in which case null is returned.
        Returns:
        The resulting string.
      • isValid

        public static boolean isValid​(int ucp)
        Checks whether the given integer represents a well-defined unicode code point that is also not an ISO control character or within the surrogate areas (high or low).
        Parameters:
        ucp - The integer (candidate code point).
        Returns:
        True if so.