NumberFormat

$(ANCHOR _NumberFormat) Determines how numbers are formatted, according to the current culture. Remarks: Numbers are formatted using format patterns retrieved from a NumberFormat instance. This class implements IFormatService.getFormat.

class NumberFormat : IFormatService {}

Constructors

this
this()

Initializes a new, culturally independent instance.

this
this(const(CultureData)* cultureData)
Undocumented in source.

Members

Functions

clone
Object clone()

Creates a copy of the instance.

getFormat
Object getFormat(TypeInfo type)

Retrieves an object defining how to format the specified type.

Properties

currencyDecimalDigits
int currencyDecimalDigits [@property getter]

Property. Retrieves the number of decimal places to use in currency values.

currencyDecimalDigits
int currencyDecimalDigits [@property setter]

Property. Assigns the number of decimal places to use in currency values.

currencyDecimalSeparator
const(char)[] currencyDecimalSeparator [@property getter]

Property. Retrieves the string used as the decimal separator in currency values.

currencyDecimalSeparator
const(char)[] currencyDecimalSeparator [@property setter]

Property. Assigns the string used as the decimal separator in currency values.

currencyGroupSeparator
const(char)[] currencyGroupSeparator [@property getter]

Property. Retrieves the string separating groups of digits to the left of the decimal place in currency values.

currencyGroupSeparator
const(char)[] currencyGroupSeparator [@property setter]

Property. Assigns the string separating groups of digits to the left of the decimal place in currency values.

currencyGroupSizes
const(int)[] currencyGroupSizes [@property getter]

Property. Retrieves the number of digits int each group to the left of the decimal place in currency values.

currencyGroupSizes
const(int)[] currencyGroupSizes [@property setter]

Property. Assigns the number of digits int each group to the left of the decimal place in currency values.

currencyNegativePattern
int currencyNegativePattern [@property getter]

Property. Retrieves the formal pattern to use for negative currency values.

currencyNegativePattern
int currencyNegativePattern [@property setter]

Property. Assigns the formal pattern to use for negative currency values.

currencyPositivePattern
int currencyPositivePattern [@property getter]

Property. Retrieves the formal pattern to use for positive currency values.

currencyPositivePattern
int currencyPositivePattern [@property setter]

Property. Assigns the formal pattern to use for positive currency values.

currencySymbol
const(char)[] currencySymbol [@property getter]

Property. Retrieves the string used as the currency symbol.

currencySymbol
const(char)[] currencySymbol [@property setter]

Property. Assigns the string used as the currency symbol.

current
NumberFormat current [@property getter]

Property. Retrieves a read-only NumberFormat instance from the current culture.

isReadOnly
bool isReadOnly [@property getter]

Property. Retrieves a value indicating whether the instance is read-only.

nanSymbol
const(char)[] nanSymbol [@property getter]

Property. Retrieves the string representing the NaN (not a number) value.

nanSymbol
const(char)[] nanSymbol [@property setter]

Property. Assigns the string representing the NaN (not a number) value.

nativeDigits
const(char[])[] nativeDigits [@property setter]

Property. Assigns a string array of native equivalents of the digits 0 to 9.

nativeDigits
const(char[])[] nativeDigits [@property getter]

Property. Retrieves a string array of native equivalents of the digits 0 to 9.

negativeInfinitySymbol
const(char)[] negativeInfinitySymbol [@property getter]

Property. Retrieves the string representing negative infinity.

negativeInfinitySymbol
const(char)[] negativeInfinitySymbol [@property setter]

Property. Assigns the string representing negative infinity.

negativeSign
const(char)[] negativeSign [@property getter]

Property. Retrieves the string denoting that a number is negative.

negativeSign
const(char)[] negativeSign [@property setter]

Property. Assigns the string denoting that a number is negative.

numberDecimalDigits
int numberDecimalDigits [@property getter]

Property. Retrieves the number of decimal places used for numbers.

numberDecimalDigits
int numberDecimalDigits [@property setter]

Assigns the number of decimal digits used for numbers.

numberDecimalSeparator
const(char)[] numberDecimalSeparator [@property getter]

Property. Retrieves the string used as the decimal separator in numbers.

numberDecimalSeparator
const(char)[] numberDecimalSeparator [@property setter]

Property. Assigns the string used as the decimal separator in numbers.

numberGroupSeparator
const(char)[] numberGroupSeparator [@property getter]

Property. Retrieves the string separating groups of digits to the left of the decimal place in numbers.

numberGroupSeparator
const(char)[] numberGroupSeparator [@property setter]

Property. Assigns the string separating groups of digits to the left of the decimal place in numbers.

numberGroupSizes
const(int)[] numberGroupSizes [@property getter]

Property. Retrieves the number of digits int each group to the left of the decimal place in numbers.

numberGroupSizes
const(int)[] numberGroupSizes [@property setter]

Property. Assigns the number of digits int each group to the left of the decimal place in numbers.

numberNegativePattern
int numberNegativePattern [@property getter]

Property. Retrieves the format pattern for negative numbers.

numberNegativePattern
int numberNegativePattern [@property setter]

Property. Assigns the format pattern for negative numbers.

positiveInfinitySymbol
const(char)[] positiveInfinitySymbol [@property getter]

Property. Retrieves the string representing positive infinity.

positiveInfinitySymbol
const(char)[] positiveInfinitySymbol [@property setter]

Property. Assigns the string representing positive infinity.

positiveSign
const(char)[] positiveSign [@property getter]

Property. Retrieves the string denoting that a number is positive.

positiveSign
const(char)[] positiveSign [@property setter]

Property. Assigns the string denoting that a number is positive.

Static functions

getInstance
NumberFormat getInstance(IFormatService formatService)

Retrieves the NumberFormat for the specified IFormatService.

invariantFormat
NumberFormat invariantFormat()

$(ANCHOR NumberFormat_invariantFormat) Property. Retrieves the read-only, culturally independent NumberFormat instance.

Variables

isReadOnly_
bool isReadOnly_;
Undocumented in source.

Inherited Members

From IFormatService

getFormat
Object getFormat(TypeInfo type)

$(ANCHOR IFormatService_getFormat) Retrieves an object that supports formatting for the specified _type.

Examples

The following example shows how to retrieve an instance of NumberFormat for a Culture and use it to display number formatting information.

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

void main(char[][] args) {
  foreach (c; Culture.getCultures(CultureTypes.Specific)) {
    if (c.twoLetterLanguageName == "en") {
      NumberFormat fmt = c.numberFormat;
      Println("The currency symbol for %s is '%s'",
        c.englishName,
        fmt.currencySymbol);
    }
  }
}

// Produces the following output:
// The currency symbol for English (United States) is '$'
// The currency symbol for English (United Kingdom) is '£'
// The currency symbol for English (Australia) is '$'
// The currency symbol for English (Canada) is '$'
// The currency symbol for English (New Zealand) is '$'
// The currency symbol for English (Ireland) is '€'
// The currency symbol for English (South Africa) is 'R'
// The currency symbol for English (Jamaica) is 'J$'
// The currency symbol for English (Caribbean) is '$'
// The currency symbol for English (Belize) is 'BZ$'
// The currency symbol for English (Trinidad and Tobago) is 'TT$'
// The currency symbol for English (Zimbabwe) is 'Z$'
// The currency symbol for English (Republic of the Philippines) is 'Php'

Meta