MessageNumberFormatters

A MessageValueFormatter for numbers (Number)

Format:

{PARAMETER_NAME, FORMAT_TYPE, FORMAT_STYLE}

Supported values for FORMAT_TYPE (see sub objects)

  • number

  • length

  • area

  • weight

  • timespan

Supported values for FORMAT_STYLE

  • "%.0P":

    • P: precision: If given, the position to which the rounding is to be made. Positive for after the decimal point, negative for before the decimal point, 0 for without decimal places.

    • 0: Tailing zeros: If given and P is given an positive, P is the exact number digits after the fraction sign. (zeros are appended if necessary)

Usage examples for number = 12345.6789:

  • {0,number} - Format parameter 0 as number, e.g. "12,345.6789"

  • {0,number, %.2} - Format parameter 0 as number with max. 2 fraction digits, e.g. "12,345.68"

  • {0,number, %.06} - Format parameter 0 as number with exact. 6 fraction digits, e.g. "12,345.678900"

  • {0,length} - Format parameter 0 as length (in meters), e.g. "12.3456789 km"

  • {0,length, %.2} - Format parameter 0 as length (in meters) with 2 fraction digits, e.g. "12.35 km"

  • {0,area} - Format parameter 0 as area (in m²), e.g. "12,345.6789 m²"

  • {0,area, %.2} - Format parameter 0 as area (in m²) with 2 fraction digits, e.g. "12,345.68 m²"

  • {0,weight} - Format parameter 0 as weight (in grams), e.g. "12.3456789 kg"

  • {0,weight, %.2} - Format parameter 0 as weight (in grams) with 2 fraction digits, e.g. "12.35 kg"

  • {0,timespan} - Format parameter 0 as timespan (in seconds), e.g. "3:25:45 h"