| Package | xp.utils |
| Class | public class NumberFormat |
| Implements | IDataFormatter |
See also
| Property | Defined by | ||
|---|---|---|---|
| currencySymbol : String = "" | NumberFormat | ||
| decimalSeparator : String = "." | NumberFormat | ||
| groupingSeparator : String = "," | NumberFormat | ||
| groupingSize : Number = 3 | NumberFormat | ||
| groupingUsed : Boolean = false | NumberFormat | ||
| intlCurrencySymbol : String = "" | NumberFormat | ||
| isCurrencyFormat : Boolean = false | NumberFormat | ||
| isScientificFormat : Boolean = false | NumberFormat | ||
| isSimple : Boolean = false | NumberFormat | ||
| maxFractionDigits : Number = 0 | NumberFormat | ||
| maxIntegerDigits : Number = 40 | NumberFormat | ||
| minFractionDigits : Number = 0 | NumberFormat | ||
| minIntegerDigits : Number = 1 | NumberFormat | ||
| multiplier : Number = 1 | NumberFormat | ||
| negPrefix : String = "-" | NumberFormat | ||
| negSuffix : String = "" | NumberFormat | ||
| parseIntOnly : Boolean = false | NumberFormat | ||
| percent : String = "" | NumberFormat | ||
| posPrefix : String = "" | NumberFormat | ||
| posSuffix : String = "" | NumberFormat | ||
| showDecimalSeparator : Boolean = false | NumberFormat | ||
| Method | Defined by | ||
|---|---|---|---|
|
NumberFormat(... rest)
Creates a NumberFormat
NumberFormat()
Creates a NumberFormat using the default pattern and symbols for the default locale.
| NumberFormat | ||
|
applyPattern(pattern:String):void
Applies the given pattern string to this format instance
Applies the given pattern string to this format.
| NumberFormat | ||
|
format(value:*):String
Formats a Number into a string
- Formats a Number into a string
| NumberFormat | ||
|
getCurrencyInstance(locale:Locale = null):NumberFormat
[static]
Returns a currency format for the current default locale.
| NumberFormat | ||
|
getInstance(locale:Locale = null, style:Number):NumberFormat
[static]
Returns the default number format for the current default locale
| NumberFormat | ||
|
getIntegerInstance(locale:Locale = null):NumberFormat
[static]
Returns the default number format for the specified locale
| NumberFormat | ||
|
getNumberInstance(locale:Locale = null):NumberFormat
[static]
Returns a general-purpose number format for the specified locale
| NumberFormat | ||
|
getPercentInstance(locale:Locale = null):NumberFormat
[static]
Returns a percentage format for the specified locale.
| NumberFormat | ||
|
parse(value:String):*
Parses text from the beginning of the given string to produce a number
- Parses text from the beginning of the given string to produce a number.
| NumberFormat | ||
| Constant | Defined by | ||
|---|---|---|---|
| CURRENCYSTYLE : int = 1 [static]
| NumberFormat | ||
| DEFAULT : int = 0 [static]
| NumberFormat | ||
| FRACTION_FIELD : int = 1 [static]
| NumberFormat | ||
| INTEGER_FIELD : int = 0 [static]
| NumberFormat | ||
| INTEGERSTYLE : int = 4 [static]
| NumberFormat | ||
| NUMBERSTYLE : int = 0 [static]
| NumberFormat | ||
| PERCENTSTYLE : int = 2 [static]
| NumberFormat | ||
| SCIENTIFICSTYLE : int = 3 [static]
| NumberFormat | ||
| currencySymbol | property |
public var currencySymbol:String = ""
| decimalSeparator | property |
public var decimalSeparator:String = "."
| groupingSeparator | property |
public var groupingSeparator:String = ","
| groupingSize | property |
public var groupingSize:Number = 3
| groupingUsed | property |
public var groupingUsed:Boolean = false
| intlCurrencySymbol | property |
public var intlCurrencySymbol:String = ""
| isCurrencyFormat | property |
public var isCurrencyFormat:Boolean = false
| isScientificFormat | property |
public var isScientificFormat:Boolean = false
| isSimple | property |
public var isSimple:Boolean = false
| maxFractionDigits | property |
public var maxFractionDigits:Number = 0
| maxIntegerDigits | property |
public var maxIntegerDigits:Number = 40
| minFractionDigits | property |
public var minFractionDigits:Number = 0
| minIntegerDigits | property |
public var minIntegerDigits:Number = 1
| multiplier | property |
public var multiplier:Number = 1
| negPrefix | property |
public var negPrefix:String = "-"
| negSuffix | property |
public var negSuffix:String = ""
| parseIntOnly | property |
public var parseIntOnly:Boolean = false
| percent | property |
public var percent:String = ""
| posPrefix | property |
public var posPrefix:String = ""
| posSuffix | property |
public var posSuffix:String = ""
| showDecimalSeparator | property |
public var showDecimalSeparator:Boolean = false
| NumberFormat | () | constructor |
public function NumberFormat(... rest)Creates a NumberFormat NumberFormat() Creates a NumberFormat using the default pattern and symbols for the default locale. NumberFormat(pattern:String) Creates a NumberFormat using the given pattern and the symbols for the default locale. NumberFormat(pattern:String, locale:Local) Creates a NumberFormat using the given pattern and symbols for the given locale.
Parameters... rest |
| applyPattern | () | method |
public function applyPattern(pattern:String):voidApplies the given pattern string to this format instance Applies the given pattern string to this format.
Parameterspattern:String — - the new number pattern for this format
|
| format | () | method |
public function format(value:*):StringFormats a Number into a string - Formats a Number into a string
Parametersvalue:* — - the Number value to be formatted into a string.
|
String — the formatted string.
|
| getCurrencyInstance | () | method |
public static function getCurrencyInstance(locale:Locale = null):NumberFormatReturns a currency format for the current default locale.
Parameterslocale:Locale (default = null) — - the locale for which a number format is needed, uses default locale if not specified
|
NumberFormat —
a number format for currency values
|
| getInstance | () | method |
public static function getInstance(locale:Locale = null, style:Number):NumberFormatReturns the default number format for the current default locale
Parameterslocale:Locale (default = null) — - the locale for which a number format is needed, uses default locale if not specified
|
|
style:Number |
NumberFormat —
a number format
|
| getIntegerInstance | () | method |
public static function getIntegerInstance(locale:Locale = null):NumberFormatReturns the default number format for the specified locale
Parameterslocale:Locale (default = null) — - the locale for which a number format is needed, uses default locale if not specified
|
NumberFormat —
a number format for integer values
|
| getNumberInstance | () | method |
public static function getNumberInstance(locale:Locale = null):NumberFormatReturns a general-purpose number format for the specified locale
Parameterslocale:Locale (default = null) — - the locale for which a number format is needed, uses default locale if not specified
|
NumberFormat —
a number format for number values
|
| getPercentInstance | () | method |
public static function getPercentInstance(locale:Locale = null):NumberFormatReturns a percentage format for the specified locale.
Parameterslocale:Locale (default = null) — - the locale for which a number format is needed, uses default locale if not specified
|
NumberFormat —
a number format for percent values
|
| parse | () | method |
public function parse(value:String):*Parses text from the beginning of the given string to produce a number - Parses text from the beginning of the given string to produce a number. The method may not use the entire text of the given string.
Parametersvalue:String — - A String whose beginning should be parsed
|
* — A Number parsed from the string
|
| CURRENCYSTYLE | constant |
public static const CURRENCYSTYLE:int = 1
| DEFAULT | constant |
public static const DEFAULT:int = 0
| FRACTION_FIELD | constant |
public static const FRACTION_FIELD:int = 1
| INTEGER_FIELD | constant |
public static const INTEGER_FIELD:int = 0
| INTEGERSTYLE | constant |
public static const INTEGERSTYLE:int = 4
| NUMBERSTYLE | constant |
public static const NUMBERSTYLE:int = 0
| PERCENTSTYLE | constant |
public static const PERCENTSTYLE:int = 2
| SCIENTIFICSTYLE | constant |
public static const SCIENTIFICSTYLE:int = 3