[intro]     [up]

Class NumberParser

Extends Class: Parser

A parser for numeric values.

Example
var parser = new NumberParser(2, ",", ".", true, "US$", true);
alert(parser.format(3234.2)); //Result is "US$ 3.234,20"
alert(parser.parse("US$ 3.234,20")); //Result is 3234.2
alert(parser.parse("ABC")); //Result is null


Constructor Arguments
Name Type Default Description
decimalDigits Number The JST_DEFAULT_DECIMAL_DIGITS value The number of decimal digits. -1 Means no limit
decimalSeparator String The JST_DEFAULT_DECIMAL_SEPARATOR value The decimal separator
groupSeparator String The JST_DEFAULT_GROUP_SEPARATOR value The group (thousands) separator
useGrouping boolean The JST_DEFAULT_USE_GROUPING value Will grouping separator be used?
currencySymbol String The JST_DEFAULT_CURRENCY_SYMBOL value The currency symbol
useCurrency boolean The JST_DEFAULT_USE_CURRENCY value Will the currencySymbol be used?
negativeParenthesis boolean The JST_DEFAULT_NEGATIVE_PARENTHESIS value Use parenthesis (true) or '-' (false) for negative values?
groupSize Number The JST_DEFAULT_GROUP_SIZE value The number of digits to be grouped together
spaceAfterCurrency boolean The JST_DEFAULT_SPACE_AFTER_CURRENCY value Indicates if a space will be inserted after the currency symbol
currencyInside boolean The JST_DEFAULT_CURRENCY_INSIDE value Indicates if, on negative numbers, the currency symbol will be placed between the minus sign and the number, or inside the parenthesis

Properties
currencyInside Indicates if, on negative numbers, the currency symbol will be placed between the minus sign and the number, or inside the parenthesis
currencySymbol The currency symbol
decimalDigits The number of decimal digits
decimalSeparator The decimal separator
groupSeparator The group (thousands) separator
groupSize The number of digits to be grouped together
negativeParenthesis Use parenthesis (true) or '-' (false) for negative values?
spaceAfterCurrency Indicates if a space will be inserted after the currency symbol
useCurrency Will the currencySymbol be used?
useGrouping Will grouping separator be used?

Methods
round Rounds the number to the precision



Properties
currencyInside
Indicates if, on negative numbers, the currency symbol will be placed between the minus sign and the number, or inside the parenthesis
currencySymbol
The currency symbol
decimalDigits
The number of decimal digits. -1 Means no limit
decimalSeparator
The decimal separator
groupSeparator
The group (thousands) separator
groupSize
The number of digits to be grouped together
negativeParenthesis
Use parenthesis (true) or '-' (false) for negative values?
spaceAfterCurrency
Indicates if a space will be inserted after the currency symbol
useCurrency
Will the currencySymbol be used?
useGrouping
Will grouping separator be used?





Methods
 
round
Rounds the number to the precision
Arguments
Name Type Default Description
number Number   The Number to be rounded