Pacotemx.formatters
Classepublic class NumberBase
HerançaNumberBase Inheritance Object

The NumberBase class is a utility class that contains general number formatting capabilities, including rounding, precision, thousands formatting, and negative sign formatting. The implementation of the formatter classes use this class.

Veja também

mx.formatters.NumberFormatter
mx.formatters.NumberBaseRoundType


Propriedades Públicas
 PropriedadeDefinido por
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  decimalSeparatorFrom : String
Decimal separator character to use when parsing an input String.
NumberBase
  decimalSeparatorTo : String
Decimal separator character to use when outputting formatted decimal numbers.
NumberBase
  isValid : Boolean = false
If true, the format succeeded, otherwise it is false.
NumberBase
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
  thousandsSeparatorFrom : String
Character to use as the thousands separator in the input String.
NumberBase
  thousandsSeparatorTo : String
Character to use as the thousands separator in the output String.
NumberBase
Métodos Públicos
 MétodoDefinido por
  
NumberBase(decimalSeparatorFrom:String = ".", thousandsSeparatorFrom:String = ",", decimalSeparatorTo:String = ".", thousandsSeparatorTo:String = ",")
Constructor.
NumberBase
  
Formats a number by replacing the default decimal separator, ".", with the decimal separator specified by decimalSeparatorTo.
NumberBase
  
Formats a negative number with either a minus sign (-) or parentheses ().
NumberBase
  
formatPrecision(value:String, precision:int):String
Formats a number by setting its decimal precision by using the decimalSeparatorTo property as the decimal separator.
NumberBase
  
formatRounding(value:String, roundType:String):String
Formats a number by rounding it.
NumberBase
  
formatRoundingWithPrecision(value:String, roundType:String, precision:int):String
Formats a number by rounding it and setting the decimal precision.
NumberBase
  
Formats a number by using the thousandsSeparatorTo property as the thousands separator and the decimalSeparatorTo property as the decimal separator.
NumberBase
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
  
Extracts a number from a formatted String.
NumberBase
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Detalhes da propriedade
decimalSeparatorFrompropriedade
public var decimalSeparatorFrom:String

Decimal separator character to use when parsing an input String.

The default value is ".".

decimalSeparatorTopropriedade 
public var decimalSeparatorTo:String

Decimal separator character to use when outputting formatted decimal numbers.

The default value is ".".

isValidpropriedade 
public var isValid:Boolean = false

If true, the format succeeded, otherwise it is false.

thousandsSeparatorFrompropriedade 
public var thousandsSeparatorFrom:String

Character to use as the thousands separator in the input String.

The default value is ",".

thousandsSeparatorTopropriedade 
public var thousandsSeparatorTo:String

Character to use as the thousands separator in the output String.

The default value is ",".

Detalhes do construtor
NumberBase()Construtor
public function NumberBase(decimalSeparatorFrom:String = ".", thousandsSeparatorFrom:String = ",", decimalSeparatorTo:String = ".", thousandsSeparatorTo:String = ",")

Constructor.

Parâmetros
decimalSeparatorFrom:String (default = ".") — Decimal separator to use when parsing an input String.
 
thousandsSeparatorFrom:String (default = ",") — Character to use as the thousands separator in the input String.
 
decimalSeparatorTo:String (default = ".") — Decimal separator character to use when outputting formatted decimal numbers.
 
thousandsSeparatorTo:String (default = ",") — Character to use as the thousands separator in the output String.
Detalhes do método
formatDecimal()método
public function formatDecimal(value:String):String

Formats a number by replacing the default decimal separator, ".", with the decimal separator specified by decimalSeparatorTo.

Parâmetros

value:String — The String value of the Number (formatted American style ####.##).

Retorna
String — String representation of the input where "." is replaced with the decimal formatting character.
formatNegative()método 
public function formatNegative(value:String, useSign:Boolean):String

Formats a negative number with either a minus sign (-) or parentheses ().

Parâmetros

value:String — Value to be formatted.
 
useSign:Boolean — If true, use a minus sign (-). If false, use parentheses ().

Retorna
String — Formatted number.
formatPrecision()método 
public function formatPrecision(value:String, precision:int):String

Formats a number by setting its decimal precision by using the decimalSeparatorTo property as the decimal separator.

Parâmetros

value:String — Value to be formatted.
 
precision:int — Number of decimal points to use.

Retorna
String — Formatted number.
formatRounding()método 
public function formatRounding(value:String, roundType:String):String

Formats a number by rounding it. The possible rounding types are defined by mx.formatters.NumberBaseRoundType.

Parâmetros

value:String — Value to be rounded.
 
roundType:String — The type of rounding to perform: NumberBaseRoundType.NONE, NumberBaseRoundType.UP, NumberBaseRoundType.DOWN, or NumberBaseRoundType.NEAREST.

Retorna
String — Formatted number.

Veja também

formatRoundingWithPrecision()método 
public function formatRoundingWithPrecision(value:String, roundType:String, precision:int):String

Formats a number by rounding it and setting the decimal precision. The possible rounding types are defined by mx.formatters.NumberBaseRoundType.

Parâmetros

value:String — Value to be rounded.
 
roundType:String — The type of rounding to perform: NumberBaseRoundType.NONE, NumberBaseRoundType.UP, NumberBaseRoundType.DOWN, or NumberBaseRoundType.NEAREST.
 
precision:int — int of decimal places to use.

Retorna
String — Formatted number.

Veja também

formatThousands()método 
public function formatThousands(value:String):String

Formats a number by using the thousandsSeparatorTo property as the thousands separator and the decimalSeparatorTo property as the decimal separator.

Parâmetros

value:String — Value to be formatted.

Retorna
String — Formatted number.
parseNumberString()método 
public function parseNumberString(str:String):String

Extracts a number from a formatted String. Examines the String from left to right and returns the first number sequence. Ignores thousands separators and includes the decimal and numbers trailing the decimal.

Parâmetros

str:String — String to parse for the numeric value.

Retorna
String — Value, which can be a decimal.