Class NumberFormatInfo

Description

NumberFormatInfo class

Defines how numeric values are formatted and displayed, depending on the culture. Numeric values are formatted using standard or custom patterns stored in the properties of a NumberFormatInfo.

This class contains information, such as currency, decimal separators, and other numeric symbols.

To create a NumberFormatInfo for a specific culture, create a CultureInfo for that culture and retrieve the CultureInfo->NumberFormat property. Or use NumberFormatInfo::getInstance($culture). To create a NumberFormatInfo for the invariant culture, use the InvariantInfo::getInvariantInfo().

Located in /I18N/core/NumberFormatInfo.php (line 48)


	
			
Class Constant Summary
Variable Summary
array $pattern
array $properties
Method Summary
NumberFormatInfo __construct ([array $data = array()], [mixed $type = NumberFormatInfo::DECIMAL])
string getCurrencySymbol ([mixed $currency = 'USD'])
void getDigitSize ()
string getGroupSeparator (parameter 0)
array getGroupSizes ()
NumberFormatInfo getInstance ([CultureInfo $culture = null], [int $type = NumberFormatInfo::DECIMAL])
NumberFormatInfo getInvariantInfo ([mixed $type = NumberFormatInfo::DECIMAL])
string getNaNSymbol ()
string getNegativeSign ()
void getPattern ()
string getPercentSymbol ()
string getPerMilleSymbol ()
string getPositiveSign ()
array getPrePostfix (string $pattern)
array parsePattern (string $pattern)
void setCurrencySymbol (string $symbol)
void setDecimalDigits (int $value)
void setDecimalSeparator (string $value)
void setDigitSize (mixed $value)
void setGroupSeparator (string $value)
void setGroupSizes (array $groupSize)
void setNaNSymbol (string $value)
void setNegativeInfinitySymbol (string $value)
void setNegativePattern (arary $pattern)
void setNegativeSign (string $value)
void setPattern ([int $type = NumberFormatInfo::DECIMAL])
void setPercentSymbol (string $value)
void setPerMilleSymbol (string $value)
void setPositiveInfinitySymbol (string $value)
void setPositivePattern (arary $pattern)
void setPositiveSign (string $value)
mixed __get (mixed $name)
void __set (mixed $name, mixed $value)
Variables
array $pattern = array() (line 67)

The number pattern.

  • access: protected
array $properties = array() (line 61)

A list of properties that are accessable/writable.

  • access: protected
Methods
Constructor __construct (line 110)

Initializes a new writable instance of the NumberFormatInfo class

that is dependent on the ICU data for number, decimal, and currency formatting information. N.B.You should not initialize this class directly unless you know what you are doing. Please use use NumberFormatInfo::getInstance() to create an instance.

NumberFormatInfo __construct ([array $data = array()], [mixed $type = NumberFormatInfo::DECIMAL])
  • array $data: ICU data for date time formatting.
getCurrencyInstance (line 210)

Returns the currency format info associated with the specified culture.

  • return: NumberFormatInfo for the specified culture.
  • static:
  • access: public
NumberFormatInfo getCurrencyInstance ([CultureInfo $culture = null])
  • CultureInfo $culture: the culture that gets the NumberFormat property.
getCurrencySymbol (line 506)

Gets the string to use as the currency symbol.

  • return: currency symbol.
string getCurrencySymbol ([mixed $currency = 'USD'])
getDecimalDigits (line 362)

Indicates the number of decimal places.

  • return: number of decimal places.
int getDecimalDigits ()
getDecimalSeparator (line 390)

Gets the string to use as the decimal separator.

  • return: decimal separator.
string getDecimalSeparator ()
getDigitSize (line 376)
void getDigitSize ()
getGroupSeparator (line 410)

Gets the string that separates groups of digits to the left of the decimal in currency values.

  • return: currency group separator.
string getGroupSeparator (parameter 0)
  • parameter 0
getGroupSizes (line 431)

Gets the number of digits in each group to the left of the decimal There can be two grouping sizes, this fucntion returns array(group1, group2), if there is only 1 grouping size, group2 will be false.

  • return: grouping size(s).
array getGroupSizes ()
getInstance (line 179)

Returns the NumberFormatInfo associated with the specified culture.

  • return: NumberFormatInfo for the specified culture.
  • static:
  • access: public
  • see: getScientificInstance();
  • see: getPercentageInstance();
  • see: getCurrencyInstance();
NumberFormatInfo getInstance ([CultureInfo $culture = null], [int $type = NumberFormatInfo::DECIMAL])
  • CultureInfo $culture: the culture that gets the NumberFormat property.
  • int $type: the number formatting type, it should be NumberFormatInfo::DECIMAL, NumberFormatInfo::CURRENCY, NumberFormatInfo::PERCENTAGE, or NumberFormatInfo::SCIENTIFIC
getInvariantInfo (line 155)

Gets the default NumberFormatInfo that is culture-independent (invariant).

  • return: default NumberFormatInfo.
  • access: public
NumberFormatInfo getInvariantInfo ([mixed $type = NumberFormatInfo::DECIMAL])
getNaNSymbol (line 600)

Gets the string that represents the IEEE NaN (not a number) value.

  • return: NaN symbol.
string getNaNSymbol ()
getNegativeInfinitySymbol (line 528)

Gets the string that represents negative infinity.

  • return: negative infinity.
string getNegativeInfinitySymbol ()
getNegativePattern (line 458)

Gets the format pattern for negative values.

The negative pattern is composed of a prefix, and postfix. This function returns array(prefix, postfix).

  • return: negative pattern.
arary getNegativePattern ()
getNegativeSign (line 564)

Gets the string that denotes that the associated number is negative.

  • return: negative sign.
string getNegativeSign ()
getPattern (line 145)
void getPattern ()
getPercentageInstance (line 221)

Returns the percentage format info associated with the specified culture.

  • return: NumberFormatInfo for the specified culture.
  • static:
  • access: public
NumberFormatInfo getPercentageInstance ([CultureInfo $culture = null])
  • CultureInfo $culture: the culture that gets the NumberFormat property.
getPercentSymbol (line 618)

Gets the string to use as the percent symbol.

  • return: percent symbol.
string getPercentSymbol ()
getPerMilleSymbol (line 636)

Gets the string to use as the per mille symbol.

  • return: percent symbol.
string getPerMilleSymbol ()
getPositiveInfinitySymbol (line 546)

Gets the string that represents positive infinity.

  • return: positive infinity.
string getPositiveInfinitySymbol ()
getPositivePattern (line 483)

Gets the format pattern for positive values.

The positive pattern is composed of a prefix, and postfix. This function returns array(prefix, postfix).

  • return: positive pattern.
arary getPositivePattern ()
getPositiveSign (line 582)

Gets the string that denotes that the associated number is positive.

  • return: positive sign.
string getPositiveSign ()
getPrePostfix (line 350)

Get the prefix and postfix of a pattern.

  • return: of prefix and postfix, array(prefix,postfix).
  • access: protected
array getPrePostfix (string $pattern)
  • string $pattern: pattern
getScientificInstance (line 232)

Returns the scientific format info associated with the specified culture.

  • return: NumberFormatInfo for the specified culture.
  • static:
  • access: public
NumberFormatInfo getScientificInstance ([CultureInfo $culture = null])
  • CultureInfo $culture: the culture that gets the NumberFormat property.
parsePattern (line 242)

Parse the given pattern and return a list of known properties.

  • return: list of pattern properties.
  • access: protected
array parsePattern (string $pattern)
  • string $pattern: a number pattern.
setCurrencySymbol (line 519)

Set the string to use as the currency symbol.

void setCurrencySymbol (string $symbol)
  • string $symbol: currency symbol.
setDecimalDigits (line 371)

Set the number of decimal places.

void setDecimalDigits (int $value)
  • int $value: number of decimal places.
setDecimalSeparator (line 399)

Set the string to use as the decimal separator.

void setDecimalSeparator (string $value)
  • string $value: the decimal point
setDigitSize (line 381)
void setDigitSize (mixed $value)
setGroupSeparator (line 419)

Set the string to use as the group separator.

void setGroupSeparator (string $value)
  • string $value: the group separator.
setGroupSizes (line 446)

Set the number of digits in each group to the left of the decimal.

There can be two grouping sizes, the value should be an array(group1, group2), if there is only 1 grouping size, group2 should be false.

void setGroupSizes (array $groupSize)
  • array $groupSize: grouping size(s).
setNaNSymbol (line 609)

Set the string that represents the IEEE NaN (not a number) value.

void setNaNSymbol (string $value)
  • string $value: NaN symbol.
setNegativeInfinitySymbol (line 537)

Set the string that represents negative infinity.

void setNegativeInfinitySymbol (string $value)
  • string $value: negative infinity.
setNegativePattern (line 471)

Set the format pattern for negative values.

The negative pattern is composed of a prefix, and postfix in the form array(prefix, postfix).

void setNegativePattern (arary $pattern)
  • arary $pattern: negative pattern.
setNegativeSign (line 573)

Set the string that denotes that the associated number is negative.

void setNegativeSign (string $value)
  • string $value: negative sign.
setPattern (line 128)

Set the pattern for a specific number pattern. The validate patterns

NumberFormatInfo::DECIMAL, NumberFormatInfo::CURRENCY, NumberFormatInfo::PERCENTAGE, or NumberFormatInfo::SCIENTIFIC

void setPattern ([int $type = NumberFormatInfo::DECIMAL])
  • int $type: pattern type.
setPercentSymbol (line 627)

Set the string to use as the percent symbol.

void setPercentSymbol (string $value)
  • string $value: percent symbol.
setPerMilleSymbol (line 645)

Set the string to use as the per mille symbol.

void setPerMilleSymbol (string $value)
  • string $value: percent symbol.
setPositiveInfinitySymbol (line 555)

Set the string that represents positive infinity.

void setPositiveInfinitySymbol (string $value)
  • string $value: positive infinity.
setPositivePattern (line 496)

Set the format pattern for positive values.

The positive pattern is composed of a prefix, and postfix in the form array(prefix, postfix).

void setPositivePattern (arary $pattern)
  • arary $pattern: positive pattern.
setPositiveSign (line 591)

Set the string that denotes that the associated number is positive.

void setPositiveSign (string $value)
  • string $value: positive sign.
__get (line 79)

Allow functions that begins with 'set' to be called directly as an attribute/property to retrieve the value.

mixed __get (mixed $name)
__set (line 92)

Allow functions that begins with 'set' to be called directly as an attribute/property to set the value.

void __set (mixed $name, mixed $value)
Class Constants
CURRENCY = 1 (line 70)
DECIMAL = 0 (line 69)
PERCENTAGE = 2 (line 71)
SCIENTIFIC = 3 (line 72)

Documentation generated on Sun, 04 Jun 2006 18:58:31 -0400 by phpDocumentor 1.3.0RC4