Class NumberFormatter


  • public class NumberFormatter
    extends java.lang.Object
    Class NumberFormatter defines a method to format a ArrayList of integers as a character string according to a supplied format specification.
    • Constructor Summary

      Constructors 
      Constructor Description
      NumberFormatter()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      UnicodeString format​(java.util.List<java.lang.Object> numbers, int groupSize, java.lang.String groupSeparator, java.lang.String letterValue, java.lang.String ordinal, Numberer numberer)
      Format a list of numbers.
      static boolean isLetterOrDigit​(int c)
      Determine whether a (possibly non-BMP) character is a letter or digit.
      void prepare​(java.lang.String format)
      Tokenize the format pattern.
      • Methods inherited from class java.lang.Object

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

      • NumberFormatter

        public NumberFormatter()
    • Method Detail

      • prepare

        public void prepare​(java.lang.String format)
        Tokenize the format pattern.
        Parameters:
        format - the format specification. Contains one of the following values:
        • "1": conventional decimal numbering
        • "a": sequence a, b, c, ... aa, ab, ac, ...
        • "A": sequence A, B, C, ... AA, AB, AC, ...
        • "i": sequence i, ii, iii, iv, v ...
        • "I": sequence I, II, III, IV, V, ...
        This symbol may be preceded and followed by punctuation (any other characters) which is copied to the output string.
      • isLetterOrDigit

        public static boolean isLetterOrDigit​(int c)
        Determine whether a (possibly non-BMP) character is a letter or digit.
        Parameters:
        c - the codepoint of the character to be tested
        Returns:
        true if this is a number or letter as defined in the XSLT rules for xsl:number pictures.
      • format

        public UnicodeString format​(java.util.List<java.lang.Object> numbers,
                                    int groupSize,
                                    java.lang.String groupSeparator,
                                    java.lang.String letterValue,
                                    java.lang.String ordinal,
                                    Numberer numberer)
        Format a list of numbers.
        Parameters:
        numbers - the numbers to be formatted (a sequence of integer values; it may also contain preformatted strings as part of the error recovery fallback)
        groupSize - the grouping-size, as in xsl:number
        groupSeparator - the grouping-separator, as in xsl:number
        letterValue - the letter-value, as in xsl:number
        ordinal - the ordinal attribute as in xsl:number
        numberer - the Numberer to be used for localization
        Returns:
        the formatted output string.