Skip to main content

Number

Overview​

Formats a given number based on various additional hints, such that its appearance becomes aligned with the desired scheme.

<number

  value: number

  ↪ Numeric value to format

  absolute, abs: boolean(false)

  ↪ Whether to disregard the negative sign

  integer, int: boolean(false)

  ↪ Whether to disregard the fractional part

  format: string(null)

  ↪ Pattern to format the number with

  ↪ See: https://docs.oracle.com/javase/8/docs/api/java/text/DecimalFormat.html

  rounding: string(null)

  ↪ Rounding-mode to use when truncating decimal-digits

  ↪ See: https://docs.oracle.com/javase/8/docs/api/java/math/RoundingMode.html

  locale: string(null)

  ↪ Dictates separators, grouping-symbols and currencies

  ↪ E.g. de_AT, en_GB, etc.

/>

Examples​

Fixed Decimals​

Formatting a fractional value of arbitrary complexity to a visually appealing two-decimals number.

Code-Blocks are only available within the browser

Value Shorthand​

For convenience, the Code-Blocks are only available within the browser attribute also supports a bound expression of arbitrary name, while all other attributes support bound expressions with matching names.

Code-Blocks are only available within the browser

Absolute Values​

Removing the negative-sign Code-Blocks are only available within the browser, if any.

Code-Blocks are only available within the browser

Whole Numbers​

Dropping all decimal digits, if any.

Code-Blocks are only available within the browser

Padding​

Adding additional leading zeroes, as to ensure a fixed width.

Code-Blocks are only available within the browser