NumberFormat.numberNegativePattern

Property. Assigns the format pattern for negative numbers.

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

Examples

The following example shows the effect of the different patterns.

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

void main() {
  NumberFormat fmt = new NumberFormat;
  int n = -5678;

  // Display the default pattern.
  Println(Formatter.format(fmt, "{0:N}", n));

  // Display all patterns.
  for (int i = 0; i <= 4; i++) {
    fmt.numberNegativePattern = i;
    Println(Formatter.format(fmt, "{0:N}", n));
  }
}

// Produces the following output:
// (5,678.00)
// (5,678.00)
// -5,678.00
// - 5,678.00
// 5,678.00-
// 5,678.00 -

Meta