PHP Класс Prado\I18N\core\NumberFormatInfo

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().
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$pattern array The number pattern.
$properties array A list of properties that are accessable/writable.

Открытые методы

Метод Описание
__construct ( $data = [], $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.
__get ( $name ) : mixed Allow functions that begins with 'set' to be called directly as an attribute/property to retrieve the value.
__set ( $name, $value ) Allow functions that begins with 'set' to be called directly as an attribute/property to set the value.
getCurrencyInstance ( $culture = null ) : NumberFormatInfo Returns the currency format info associated with the specified culture.
getCurrencySymbol ( $currency = 'USD' ) : string Gets the string to use as the currency symbol.
getDecimalDigits ( ) : integer Indicates the number of decimal places.
getDecimalSeparator ( ) : string Gets the string to use as the decimal separator.
getDigitSize ( )
getGroupSeparator ( ) : string Gets the string that separates groups of digits to the left of the decimal in currency values.
getGroupSizes ( ) : array 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.
getInstance ( $culture = null, $type = NumberFormatInfo::DECIMAL ) : NumberFormatInfo Returns the NumberFormatInfo associated with the specified culture.
getInvariantInfo ( $type = NumberFormatInfo::DECIMAL ) : NumberFormatInfo Gets the default NumberFormatInfo that is culture-independent (invariant).
getNaNSymbol ( ) : string Gets the string that represents the IEEE NaN (not a number) value.
getNegativeInfinitySymbol ( ) : string Gets the string that represents negative infinity.
getNegativePattern ( ) : arary Gets the format pattern for negative values.
getNegativeSign ( ) : string Gets the string that denotes that the associated number is negative.
getPattern ( )
getPerMilleSymbol ( ) : string Gets the string to use as the per mille symbol.
getPercentSymbol ( ) : string Gets the string to use as the percent symbol.
getPercentageInstance ( $culture = null ) : NumberFormatInfo Returns the percentage format info associated with the specified culture.
getPositiveInfinitySymbol ( ) : string Gets the string that represents positive infinity.
getPositivePattern ( ) : arary Gets the format pattern for positive values.
getPositiveSign ( ) : string Gets the string that denotes that the associated number is positive.
getScientificInstance ( $culture = null ) : NumberFormatInfo Returns the scientific format info associated with the specified culture.
setCurrencySymbol ( $symbol ) Set the string to use as the currency symbol.
setDecimalDigits ( $value ) Set the number of decimal places.
setDecimalSeparator ( $value ) Set the string to use as the decimal separator.
setDigitSize ( $value )
setGroupSeparator ( $value ) Set the string to use as the group separator.
setGroupSizes ( $groupSize ) Set the number of digits in each group to the left of the decimal.
setNaNSymbol ( $value ) Set the string that represents the IEEE NaN (not a number) value.
setNegativeInfinitySymbol ( $value ) Set the string that represents negative infinity.
setNegativePattern ( $pattern ) Set the format pattern for negative values.
setNegativeSign ( $value ) Set the string that denotes that the associated number is negative.
setPattern ( $type = NumberFormatInfo::DECIMAL ) Set the pattern for a specific number pattern. The validate patterns NumberFormatInfo::DECIMAL, NumberFormatInfo::CURRENCY, NumberFormatInfo::PERCENTAGE, or NumberFormatInfo::SCIENTIFIC
setPerMilleSymbol ( $value ) Set the string to use as the per mille symbol.
setPercentSymbol ( $value ) Set the string to use as the percent symbol.
setPositiveInfinitySymbol ( $value ) Set the string that represents positive infinity.
setPositivePattern ( $pattern ) Set the format pattern for positive values.
setPositiveSign ( $value ) Set the string that denotes that the associated number is positive.

Защищенные методы

Метод Описание
getPrePostfix ( $pattern ) : array Get the prefix and postfix of a pattern.
parsePattern ( $pattern ) : array Parse the given pattern and return a list of known properties.

Описание методов

__construct() публичный метод

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.
См. также: getInstance()
public __construct ( $data = [], $type = NumberFormatInfo::DECIMAL )

__get() публичный метод

Allow functions that begins with 'set' to be called directly as an attribute/property to retrieve the value.
public __get ( $name ) : mixed
Результат mixed

__set() публичный метод

Allow functions that begins with 'set' to be called directly as an attribute/property to set the value.
public __set ( $name, $value )

getCurrencyInstance() публичный статический метод

Returns the currency format info associated with the specified culture.
public static getCurrencyInstance ( $culture = null ) : NumberFormatInfo
Результат NumberFormatInfo NumberFormatInfo for the specified culture.

getCurrencySymbol() публичный метод

Gets the string to use as the currency symbol.
public getCurrencySymbol ( $currency = 'USD' ) : string
Результат string currency symbol.

getDecimalDigits() публичный метод

Indicates the number of decimal places.
public getDecimalDigits ( ) : integer
Результат integer number of decimal places.

getDecimalSeparator() публичный метод

Gets the string to use as the decimal separator.
public getDecimalSeparator ( ) : string
Результат string decimal separator.

getDigitSize() публичный метод

public getDigitSize ( )

getGroupSeparator() публичный метод

Gets the string that separates groups of digits to the left of the decimal in currency values.
public getGroupSeparator ( ) : string
Результат string currency group separator.

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.
public getGroupSizes ( ) : array
Результат array grouping size(s).

getInstance() публичный статический метод

Returns the NumberFormatInfo associated with the specified culture.
public static getInstance ( $culture = null, $type = NumberFormatInfo::DECIMAL ) : NumberFormatInfo
Результат NumberFormatInfo NumberFormatInfo for the specified culture.

getInvariantInfo() публичный статический метод

Gets the default NumberFormatInfo that is culture-independent (invariant).
public static getInvariantInfo ( $type = NumberFormatInfo::DECIMAL ) : NumberFormatInfo
Результат NumberFormatInfo default NumberFormatInfo.

getNaNSymbol() публичный метод

Gets the string that represents the IEEE NaN (not a number) value.
public getNaNSymbol ( ) : string
Результат string NaN symbol.

getNegativeInfinitySymbol() публичный метод

Gets the string that represents negative infinity.
public getNegativeInfinitySymbol ( ) : string
Результат string negative infinity.

getNegativePattern() публичный метод

The negative pattern is composed of a prefix, and postfix. This function returns array(prefix, postfix).
public getNegativePattern ( ) : arary
Результат arary negative pattern.

getNegativeSign() публичный метод

Gets the string that denotes that the associated number is negative.
public getNegativeSign ( ) : string
Результат string negative sign.

getPattern() публичный метод

public getPattern ( )

getPerMilleSymbol() публичный метод

Gets the string to use as the per mille symbol.
public getPerMilleSymbol ( ) : string
Результат string percent symbol.

getPercentSymbol() публичный метод

Gets the string to use as the percent symbol.
public getPercentSymbol ( ) : string
Результат string percent symbol.

getPercentageInstance() публичный статический метод

Returns the percentage format info associated with the specified culture.
public static getPercentageInstance ( $culture = null ) : NumberFormatInfo
Результат NumberFormatInfo NumberFormatInfo for the specified culture.

getPositiveInfinitySymbol() публичный метод

Gets the string that represents positive infinity.
public getPositiveInfinitySymbol ( ) : string
Результат string positive infinity.

getPositivePattern() публичный метод

The positive pattern is composed of a prefix, and postfix. This function returns array(prefix, postfix).
public getPositivePattern ( ) : arary
Результат arary positive pattern.

getPositiveSign() публичный метод

Gets the string that denotes that the associated number is positive.
public getPositiveSign ( ) : string
Результат string positive sign.

getPrePostfix() защищенный метод

Get the prefix and postfix of a pattern.
protected getPrePostfix ( $pattern ) : array
Результат array of prefix and postfix, array(prefix,postfix).

getScientificInstance() публичный статический метод

Returns the scientific format info associated with the specified culture.
public static getScientificInstance ( $culture = null ) : NumberFormatInfo
Результат NumberFormatInfo NumberFormatInfo for the specified culture.

parsePattern() защищенный метод

Parse the given pattern and return a list of known properties.
protected parsePattern ( $pattern ) : array
Результат array list of pattern properties.

setCurrencySymbol() публичный метод

Set the string to use as the currency symbol.
public setCurrencySymbol ( $symbol )

setDecimalDigits() публичный метод

Set the number of decimal places.
public setDecimalDigits ( $value )

setDecimalSeparator() публичный метод

Set the string to use as the decimal separator.
public setDecimalSeparator ( $value )

setDigitSize() публичный метод

public setDigitSize ( $value )

setGroupSeparator() публичный метод

Set the string to use as the group separator.
public setGroupSeparator ( $value )

setGroupSizes() публичный метод

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.
public setGroupSizes ( $groupSize )

setNaNSymbol() публичный метод

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

setNegativeInfinitySymbol() публичный метод

Set the string that represents negative infinity.
public setNegativeInfinitySymbol ( $value )

setNegativePattern() публичный метод

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

setNegativeSign() публичный метод

Set the string that denotes that the associated number is negative.
public setNegativeSign ( $value )

setPattern() публичный метод

Set the pattern for a specific number pattern. The validate patterns NumberFormatInfo::DECIMAL, NumberFormatInfo::CURRENCY, NumberFormatInfo::PERCENTAGE, or NumberFormatInfo::SCIENTIFIC
public setPattern ( $type = NumberFormatInfo::DECIMAL )

setPerMilleSymbol() публичный метод

Set the string to use as the per mille symbol.
public setPerMilleSymbol ( $value )

setPercentSymbol() публичный метод

Set the string to use as the percent symbol.
public setPercentSymbol ( $value )

setPositiveInfinitySymbol() публичный метод

Set the string that represents positive infinity.
public setPositiveInfinitySymbol ( $value )

setPositivePattern() публичный метод

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

setPositiveSign() публичный метод

Set the string that denotes that the associated number is positive.
public setPositiveSign ( $value )

Описание свойств

$pattern защищенное свойство

The number pattern.
protected array $pattern
Результат array

$properties защищенное свойство

A list of properties that are accessable/writable.
protected array $properties
Результат array