Class NumberUtils

Object
org.thymeleaf.util.NumberUtils

public final class NumberUtils extends Object
Since:
1.0
Author:
Daniel Fernández
  • Method Details

    • format

      public static String format(Number target, Integer minIntegerDigits, Locale locale)
    • format

      public static String format(Number target, Integer minIntegerDigits, NumberPointType thousandsPointType, Locale locale)
    • format

      public static String format(Number target, Integer minIntegerDigits, Integer decimalDigits, Locale locale)
    • format

      public static String format(Number target, Integer minIntegerDigits, Integer decimalDigits, NumberPointType decimalPointType, Locale locale)
    • format

      public static String format(Number target, Integer minIntegerDigits, NumberPointType thousandsPointType, Integer decimalDigits, Locale locale)
    • format

      public static String format(Number target, Integer minIntegerDigits, NumberPointType thousandsPointType, Integer decimalDigits, NumberPointType decimalPointType, Locale locale)
    • sequence

      public static Integer[] sequence(Integer from, Integer to)

      Produces an array with a sequence of integer numbers.

      Parameters:
      from - value to start the sequence from
      to - value to produce the sequence to
      Returns:
      the Integer[] sequence
      Since:
      1.1.2
    • sequence

      public static Integer[] sequence(Integer from, Integer to, Integer step)

      Produces an array with a sequence of integer numbers, using a step.

      Parameters:
      from - value to start the sequence from
      to - value to produce the sequence to
      step - the step to be used
      Returns:
      the Integer[] sequence
      Since:
      2.0.9
    • formatCurrency

      public static String formatCurrency(Number target, Locale locale)
      Formats a number as a currency value according to the specified locale.
      Parameters:
      target - The number to format.
      locale - Locale to use for formatting.
      Returns:
      The number formatted as a currency, or null if the number given is null.
    • formatPercent

      public static String formatPercent(Number target, Integer minIntegerDigits, Integer fractionDigits, Locale locale)
      Formats a number as a percentage value.
      Parameters:
      target - The number to format.
      minIntegerDigits - Minimum number of digits to return (0 padding).
      fractionDigits - Minimum number of fraction digits to return (0 padding).
      locale - Locale to use for formatting.
      Returns:
      The number formatted as a percentage, or null if the number given is null.