Class CharacterUtils


  • public class CharacterUtils
    extends java.lang.Object
    Utility methods for dealing with Unicode characters.

    These methods exist to encapsulate the semantics in a way that can be translated into C#.

    • Constructor Summary

      Constructors 
      Constructor Description
      CharacterUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int getNthRune​(java.lang.String input, int pos)
      Get the nth code point from a string.
      static java.util.List<java.lang.Integer> getRunes​(java.lang.String input)
      Return the code points in a string.
      static boolean isControl​(int codepoint)  
      static boolean isWhitespace​(int codepoint)  
      static int runeLength​(java.lang.String input)
      Return the length (in code points) of a string.
      static char[] toChars​(int codepoint)  
      • Methods inherited from class java.lang.Object

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

      • CharacterUtils

        public CharacterUtils()
    • Method Detail

      • runeLength

        public static int runeLength​(java.lang.String input)
        Return the length (in code points) of a string.
        Parameters:
        input - the string.
        Returns:
        the length.
      • getRunes

        public static java.util.List<java.lang.Integer> getRunes​(java.lang.String input)
        Return the code points in a string.
        Parameters:
        input - the string.
        Returns:
        the code points.
      • getNthRune

        public static int getNthRune​(java.lang.String input,
                                     int pos)
        Get the nth code point from a string.
        Parameters:
        input - the string.
        pos - the character position.
        Returns:
        the character.
        Throws:
        java.lang.IllegalArgumentException - if the position is out of range.
      • toChars

        public static char[] toChars​(int codepoint)
      • isWhitespace

        public static boolean isWhitespace​(int codepoint)
      • isControl

        public static boolean isControl​(int codepoint)