NumberFormat.numberDecimalDigits

Assigns the number of decimal digits used for numbers.

  1. int numberDecimalDigits [@property getter]
  2. int numberDecimalDigits [@property setter]
    class NumberFormat
    @property final
    void
    numberDecimalDigits
    (
    int value
    )

Throws

Exception if the property is being set and the instance is read-only.

Examples

The following example shows the effect of changing numberDecimalDigits.

import tango.io.Print, tango.text.locale.Common;

void main() {
  // Get the NumberFormat from the en-GB culture.
  NumberFormat fmt = (new Culture("en-GB")).numberFormat;

  // Display a value with the default number of decimal digits.
  int n = 5678;
  Println(Formatter.format(fmt, "{0:N}", n));

  // Display the value with six decimal digits.
  fmt.numberDecimalDigits = 6;
  Println(Formatter.format(fmt, "{0:N}", n));
}

// Produces the following output:
// 5,678.00
// 5,678.000000

Meta