Packagexp.utils
Classpublic class NumberFormat
ImplementsIDataFormatter

Number Format - a class for formatting Number types

See also

support


Public Properties
 PropertyDefined 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
Public Methods
 MethodDefined 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
Public Constants
 ConstantDefined 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
Property detail
currencySymbolproperty
public var currencySymbol:String = ""
decimalSeparatorproperty 
public var decimalSeparator:String = "."
groupingSeparatorproperty 
public var groupingSeparator:String = ","
groupingSizeproperty 
public var groupingSize:Number = 3
groupingUsedproperty 
public var groupingUsed:Boolean = false
intlCurrencySymbolproperty 
public var intlCurrencySymbol:String = ""
isCurrencyFormatproperty 
public var isCurrencyFormat:Boolean = false
isScientificFormatproperty 
public var isScientificFormat:Boolean = false
isSimpleproperty 
public var isSimple:Boolean = false
maxFractionDigitsproperty 
public var maxFractionDigits:Number = 0
maxIntegerDigitsproperty 
public var maxIntegerDigits:Number = 40
minFractionDigitsproperty 
public var minFractionDigits:Number = 0
minIntegerDigitsproperty 
public var minIntegerDigits:Number = 1
multiplierproperty 
public var multiplier:Number = 1
negPrefixproperty 
public var negPrefix:String = "-"
negSuffixproperty 
public var negSuffix:String = ""
parseIntOnlyproperty 
public var parseIntOnly:Boolean = false
percentproperty 
public var percent:String = ""
posPrefixproperty 
public var posPrefix:String = ""
posSuffixproperty 
public var posSuffix:String = ""
showDecimalSeparatorproperty 
public var showDecimalSeparator:Boolean = false
Constructor detail
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
Method detail
applyPattern()method
public function applyPattern(pattern:String):void

Applies the given pattern string to this format instance Applies the given pattern string to this format.

Parameters
pattern:String — - the new number pattern for this format
format()method 
public function format(value:*):String

Formats a Number into a string - Formats a Number into a string

Parameters
value:* — - the Number value to be formatted into a string.

Returns
String — the formatted string.
getCurrencyInstance()method 
public static function getCurrencyInstance(locale:Locale = null):NumberFormat

Returns a currency format for the current default locale.

Parameters
locale:Locale (default = null) — - the locale for which a number format is needed, uses default locale if not specified

Returns
NumberFormat — a number format for currency values
getInstance()method 
public static function getInstance(locale:Locale = null, style:Number):NumberFormat

Returns the default number format for the current default locale

Parameters
locale:Locale (default = null) — - the locale for which a number format is needed, uses default locale if not specified
 
style:Number

Returns
NumberFormat — a number format
getIntegerInstance()method 
public static function getIntegerInstance(locale:Locale = null):NumberFormat

Returns the default number format for the specified locale

Parameters
locale:Locale (default = null) — - the locale for which a number format is needed, uses default locale if not specified

Returns
NumberFormat — a number format for integer values
getNumberInstance()method 
public static function getNumberInstance(locale:Locale = null):NumberFormat

Returns a general-purpose number format for the specified locale

Parameters
locale:Locale (default = null) — - the locale for which a number format is needed, uses default locale if not specified

Returns
NumberFormat — a number format for number values
getPercentInstance()method 
public static function getPercentInstance(locale:Locale = null):NumberFormat

Returns a percentage format for the specified locale.

Parameters
locale:Locale (default = null) — - the locale for which a number format is needed, uses default locale if not specified

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

Parameters
value:String — - A String whose beginning should be parsed

Returns
* — A Number parsed from the string
Constant detail
CURRENCYSTYLEconstant
public static const CURRENCYSTYLE:int = 1
DEFAULTconstant 
public static const DEFAULT:int = 0
FRACTION_FIELDconstant 
public static const FRACTION_FIELD:int = 1
INTEGER_FIELDconstant 
public static const INTEGER_FIELD:int = 0
INTEGERSTYLEconstant 
public static const INTEGERSTYLE:int = 4
NUMBERSTYLEconstant 
public static const NUMBERSTYLE:int = 0
PERCENTSTYLEconstant 
public static const PERCENTSTYLE:int = 2
SCIENTIFICSTYLEconstant 
public static const SCIENTIFICSTYLE:int = 3