System.I18N.core
[ class tree: System.I18N.core ] [ index: System.I18N.core ] [ all elements ]

Class: NumberFormatInfo

Source Location: /I18N/core/NumberFormatInfo.php

Class Overview


NumberFormatInfo class

Class Details

[line 48]
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().




version:  v1.0, last update on Sun Dec 05 14:48:26 EST 2004
author:  Xiang Wei Zhuo <weizhuo[at]gmail[dot]com>


[ Top ]

Variables

Constants

Methods



Class Variables

$pattern = array()

[line 67]

The number pattern.



access:  protected

Type:   array


[ Top ]

$properties = array()

[line 61]

A list of properties that are accessable/writable.



access:  protected

Type:   array


[ Top ]



Class Methods


constructor __construct [line 110]

NumberFormatInfo __construct( [array $data = array()], [mixed $type = NumberFormatInfo::DECIMAL])

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.






Parameters:

array   $data   ICU data for date time formatting.

[ Top ]

method getCurrencyInstance [line 210]

NumberFormatInfo getCurrencyInstance( [CultureInfo $culture = null])

Returns the currency format info associated with the specified culture.



return:  NumberFormatInfo for the specified culture.
static:  
access:  public


Parameters:

CultureInfo   $culture   the culture that gets the NumberFormat property.

[ Top ]

method getCurrencySymbol [line 488]

string getCurrencySymbol( [mixed $currency = 'USD'])

Gets the string to use as the currency symbol.



return:  currency symbol.


[ Top ]

method getDecimalDigits [line 354]

int getDecimalDigits( )

Indicates the number of decimal places.



return:  number of decimal places.


[ Top ]

method getDecimalSeparator [line 372]

string getDecimalSeparator( )

Gets the string to use as the decimal separator.



return:  decimal separator.


[ Top ]

method getGroupSeparator [line 392]

string getGroupSeparator( parameter 0)

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



return:  currency group separator.


Parameters:

parameter   0  

[ Top ]

method getGroupSizes [line 413]

array getGroupSizes( )

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).


[ Top ]

method getInstance [line 179]

NumberFormatInfo getInstance( [CultureInfo $culture = null], [int $type = NumberFormatInfo::DECIMAL])

Returns the NumberFormatInfo associated with the specified culture.



return:  NumberFormatInfo for the specified culture.
static:  
access:  public
see:  getScientificInstance();
see:  getPercentageInstance();
see:  getCurrencyInstance();


Parameters:

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

[ Top ]

method getInvariantInfo [line 155]

NumberFormatInfo getInvariantInfo( [mixed $type = NumberFormatInfo::DECIMAL])

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



return:  default NumberFormatInfo.
access:  public


[ Top ]

method getNaNSymbol [line 582]

string getNaNSymbol( )

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



return:  NaN symbol.


[ Top ]

method getNegativeInfinitySymbol [line 510]

string getNegativeInfinitySymbol( )

Gets the string that represents negative infinity.



return:  negative infinity.


[ Top ]

method getNegativePattern [line 440]

arary getNegativePattern( )

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.


[ Top ]

method getNegativeSign [line 546]

string getNegativeSign( )

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



return:  negative sign.


[ Top ]

method getPattern [line 145]

void getPattern( )



[ Top ]

method getPercentageInstance [line 221]

NumberFormatInfo getPercentageInstance( [CultureInfo $culture = null])

Returns the percentage format info associated with the specified culture.



return:  NumberFormatInfo for the specified culture.
static:  
access:  public


Parameters:

CultureInfo   $culture   the culture that gets the NumberFormat property.

[ Top ]

method getPercentSymbol [line 600]

string getPercentSymbol( )

Gets the string to use as the percent symbol.



return:  percent symbol.


[ Top ]

method getPerMilleSymbol [line 618]

string getPerMilleSymbol( )

Gets the string to use as the per mille symbol.



return:  percent symbol.


[ Top ]

method getPositiveInfinitySymbol [line 528]

string getPositiveInfinitySymbol( )

Gets the string that represents positive infinity.



return:  positive infinity.


[ Top ]

method getPositivePattern [line 465]

arary getPositivePattern( )

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.


[ Top ]

method getPositiveSign [line 564]

string getPositiveSign( )

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



return:  positive sign.


[ Top ]

method getPrePostfix [line 342]

array getPrePostfix( string $pattern)

Get the prefix and postfix of a pattern.



return:  of prefix and postfix, array(prefix,postfix).
access:  protected


Parameters:

string   $pattern   pattern

[ Top ]

method getScientificInstance [line 232]

NumberFormatInfo getScientificInstance( [CultureInfo $culture = null])

Returns the scientific format info associated with the specified culture.



return:  NumberFormatInfo for the specified culture.
static:  
access:  public


Parameters:

CultureInfo   $culture   the culture that gets the NumberFormat property.

[ Top ]

method parsePattern [line 242]

array parsePattern( string $pattern)

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



return:  list of pattern properties.
access:  protected


Parameters:

string   $pattern   a number pattern.

[ Top ]

method setCurrencySymbol [line 501]

void setCurrencySymbol( string $symbol)

Set the string to use as the currency symbol.



Parameters:

string   $symbol   currency symbol.

[ Top ]

method setDecimalDigits [line 363]

void setDecimalDigits( int $value)

Set the number of decimal places.



Parameters:

int   $value   number of decimal places.

[ Top ]

method setDecimalSeparator [line 381]

void setDecimalSeparator( string $value)

Set the string to use as the decimal separator.



Parameters:

string   $value   the decimal point

[ Top ]

method setGroupSeparator [line 401]

void setGroupSeparator( string $value)

Set the string to use as the group separator.



Parameters:

string   $value   the group separator.

[ Top ]

method setGroupSizes [line 428]

void setGroupSizes( array $groupSize)

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.




Parameters:

array   $groupSize   grouping size(s).

[ Top ]

method setNaNSymbol [line 591]

void setNaNSymbol( string $value)

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



Parameters:

string   $value   NaN symbol.

[ Top ]

method setNegativeInfinitySymbol [line 519]

void setNegativeInfinitySymbol( string $value)

Set the string that represents negative infinity.



Parameters:

string   $value   negative infinity.

[ Top ]

method setNegativePattern [line 453]

void setNegativePattern( arary $pattern)

Set the format pattern for negative values.

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




Parameters:

arary   $pattern   negative pattern.

[ Top ]

method setNegativeSign [line 555]

void setNegativeSign( string $value)

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



Parameters:

string   $value   negative sign.

[ Top ]

method setPattern [line 128]

void setPattern( [int $type = NumberFormatInfo::DECIMAL])

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

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




Parameters:

int   $type   pattern type.

[ Top ]

method setPercentSymbol [line 609]

void setPercentSymbol( string $value)

Set the string to use as the percent symbol.



Parameters:

string   $value   percent symbol.

[ Top ]

method setPerMilleSymbol [line 627]

void setPerMilleSymbol( string $value)

Set the string to use as the per mille symbol.



Parameters:

string   $value   percent symbol.

[ Top ]

method setPositiveInfinitySymbol [line 537]

void setPositiveInfinitySymbol( string $value)

Set the string that represents positive infinity.



Parameters:

string   $value   positive infinity.

[ Top ]

method setPositivePattern [line 478]

void setPositivePattern( arary $pattern)

Set the format pattern for positive values.

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




Parameters:

arary   $pattern   positive pattern.

[ Top ]

method setPositiveSign [line 573]

void setPositiveSign( string $value)

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



Parameters:

string   $value   positive sign.

[ Top ]

method __get [line 79]

mixed __get( mixed $name)

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



[ Top ]

method __set [line 92]

void __set( mixed $name, mixed $value)

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



[ Top ]


Class Constants

CURRENCY =  1

[line 70]


[ Top ]

DECIMAL =  0

[line 69]


[ Top ]

PERCENTAGE =  2

[line 71]


[ Top ]

SCIENTIFIC =  3

[line 72]


[ Top ]



© 2004-2005 PRADO Software Group. All Rights Reserved.