Class SimpleQuantityFormat

  • All Implemented Interfaces:
    Serializable, Cloneable, QuantityFormat, tech.uom.lib.common.function.Parser<CharSequence,​Quantity>

    public class SimpleQuantityFormat
    extends AbstractQuantityFormat
    A simple implementation of QuantityFormat
    The following pattern letters are defined:
    Chart shows pattern letters, date/time component, presentation, and examples.
    Letter Quantity Component Presentation Examples
    n Numeric value Number 27
    u Unit Text m
    ~ Mixed radix Text 1 m; 27 cm
    rc Range Compact min=1 m, max=5 m
    Pattern letters are usually repeated, as their number determines the exact presentation:
    • Text: For formatting, if the number of pattern letters is 4 or more, the full form is used; otherwise a short or abbreviated form is used if available. For parsing, both forms are accepted, independent of the number of pattern letters.

    • Number: For formatting, the number of pattern letters is the minimum number of digits, and shorter numbers are zero-padded to this amount. For parsing, the number of pattern letters is ignored unless it's needed to separate two adjacent fields.

    • Mixed Radix: The Mixed radix marker "~" is followed by a character sequence acting as mixed radix delimiter. This character sequence must not contain "~" itself or any numeric values.

    • Range: The Range compact part "rc" only applies to formatting instances of Range via formatRange(). It may be combined with the others. If set alone, then the default number and unit formatting is assumed.
    Since:
    2.0
    Version:
    2.3.2, Apr 23, 2025
    See Also:
    Serialized Form