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

  valuenumber

  ↪ Numeric value to format

  absolute, absboolean(false)

  ↪ Whether to disregard the negative sign

  integer, intboolean(false)

  ↪ Whether to disregard the fractional part

  formatstring(null)

  ↪ Pattern to format the number with

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

  roundingstring(null)

  ↪ Rounding-mode to use when truncating decimal-digits

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

  localestring(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

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