Class PatternStringParser

java.lang.Object
org.graalvm.shadowed.com.ibm.icu.impl.number.PatternStringParser

public class PatternStringParser extends Object
Implements a recursive descent parser for decimal format patterns.
  • Field Details

    • IGNORE_ROUNDING_NEVER

      public static final int IGNORE_ROUNDING_NEVER
      See Also:
    • IGNORE_ROUNDING_IF_CURRENCY

      public static final int IGNORE_ROUNDING_IF_CURRENCY
      See Also:
    • IGNORE_ROUNDING_ALWAYS

      public static final int IGNORE_ROUNDING_ALWAYS
      See Also:
  • Constructor Details

    • PatternStringParser

      public PatternStringParser()
  • Method Details

    • parseToPatternInfo

      public static PatternStringParser.ParsedPatternInfo parseToPatternInfo(String patternString)
      Runs the recursive descent parser on the given pattern string, returning a data structure with raw information about the pattern string.

      To obtain a more useful form of the data, consider using parseToProperties(java.lang.String, int) instead.

      Parameters:
      patternString - The LDML decimal format pattern (Excel-style pattern) to parse.
      Returns:
      The results of the parse.
    • parseToProperties

      public static DecimalFormatProperties parseToProperties(String pattern, int ignoreRounding)
      Parses a pattern string into a new property bag.
      Parameters:
      pattern - The pattern string, like "#,##0.00"
      ignoreRounding - Whether to leave out rounding information (minFrac, maxFrac, and rounding increment) when parsing the pattern. This may be desirable if a custom rounding mode, such as CurrencyUsage, is to be used instead. One of IGNORE_ROUNDING_ALWAYS, IGNORE_ROUNDING_IF_CURRENCY, or IGNORE_ROUNDING_NEVER.
      Returns:
      A property bag object.
      Throws:
      IllegalArgumentException - If there is a syntax error in the pattern string.
    • parseToProperties

      public static DecimalFormatProperties parseToProperties(String pattern)
    • parseToExistingProperties

      public static void parseToExistingProperties(String pattern, DecimalFormatProperties properties, int ignoreRounding)
      Parses a pattern string into an existing property bag. All properties that can be encoded into a pattern string will be overwritten with either their default value or with the value coming from the pattern string. Properties that cannot be encoded into a pattern string, such as rounding mode, are not modified.
      Parameters:
      pattern - The pattern string, like "#,##0.00"
      properties - The property bag object to overwrite.
      ignoreRounding - See parseToProperties(String pattern, int ignoreRounding).
      Throws:
      IllegalArgumentException - If there was a syntax error in the pattern string.
    • parseToExistingProperties

      public static void parseToExistingProperties(String pattern, DecimalFormatProperties properties)