OverviewSingleDeprecated

jsx3.util

class NumberFormat

Object
->jsx3.lang.Object
  ->jsx3.util.NumberFormat

class NumberFormat
extends jsx3.lang.Object
Formats numbers. This class in localized, meaning that numbers are formatted in a locale-sensitive way.

The format takes the form: Prefix Format Suffix. A single number format can specify a format for a positive value and one for a negative value. In this case the form is: PosPrefix PosFormat PosSuffix;NegPrefix NegFormat NegSuffix. (The spaces between prefix, format, and suffix should not be included in the actual format.)

The format can include the following characters. Each character is replaced with the locale-specific text when a number is formatted.

Since:

3.2

Constructor Summary
void
init(strFormat : String, objLocale : jsx3.util.Locale)
Method Summary
String
format(number : String | Object | Number)
static jsx3.util.NumberFormat
Returns a currency number format appropriate for objLocale.
static jsx3.util.NumberFormat
Returns an integer number format appropriate for objLocale.
jsx3.util.Locale
static jsx3.util.NumberFormat
Returns a general number format appropriate for objLocale.
static jsx3.util.NumberFormat
Returns a percent number format appropriate for objLocale.
void
String
Methods Inherited From jsx3.lang.Object
clone, equals, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf
Constructor Detail

init

void init(strFormat : String, objLocale : jsx3.util.Locale)

Parameters:

strFormat
objLocale

Throws:

{jsx3.lang.Exception}if strFormat cannot be parsed.
Method Detail

format

String format(number : String | Object | Number)

Parameters:

number

Returns:

 

getCurrencyInstance

static jsx3.util.NumberFormat getCurrencyInstance(objLocale : jsx3.util.Locale)
Returns a currency number format appropriate for objLocale.

Parameters:

objLocalethe locale for which to return a format. If this parameter is not provided, the default system locale is used.

Returns:

 

getIntegerInstance

static jsx3.util.NumberFormat getIntegerInstance(objLocale : jsx3.util.Locale)
Returns an integer number format appropriate for objLocale.

Parameters:

objLocalethe locale for which to return a format. If this parameter is not provided, the default system locale is used.

Returns:

 

getLocale

jsx3.util.Locale getLocale()

Returns:

 

getNumberInstance

static jsx3.util.NumberFormat getNumberInstance(objLocale : jsx3.util.Locale)
Returns a general number format appropriate for objLocale.

Parameters:

objLocalethe locale for which to return a format. If this parameter is not provided, the default system locale is used.

Returns:

 

getPercentInstance

static jsx3.util.NumberFormat getPercentInstance(objLocale : jsx3.util.Locale)
Returns a percent number format appropriate for objLocale.

Parameters:

objLocalethe locale for which to return a format. If this parameter is not provided, the default system locale is used.

Returns:

 

setLocale

void setLocale(objLocale : jsx3.util.Locale)

Parameters:

objLocale

toString

String toString()

Returns:

 

Overrides:

toString in jsx3.lang.Object