OverviewSingleDeprecatedPropertiesEventsXSL Parameters

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

Field Summary
static int
CURRENCY
Type for a currency number format.
static int
INTEGER
Type for an integer number format.
static int
NUMBER
Type for a decimal number format.
Constructor Summary
void
init(strFormat : String, objLocale : jsx3.util.Locale)
Creates a new number format instance.
Method Summary
String
format(number : String | Object | Number)
static jsx3.util.NumberFormat
Returns a currency number format appropriate for objLocale.
static jsx3.util.NumberFormat
getInstance(intType : int, objLocale : jsx3.util.Locale)
Returns a 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.
Number
parse(s : String)
Parses a string according to this number format and returns the resulting value.
void
String
Methods Inherited From jsx3.lang.Object
clone, equals, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf
Field Detail

CURRENCY

static final int CURRENCY
Type for a currency number format.

INTEGER

static final int INTEGER
Type for an integer number format.

NUMBER

static final int NUMBER
Type for a decimal number format.
Constructor Detail

init

void init(strFormat : String, objLocale : jsx3.util.Locale)
Creates a new number format instance.

Parameters:

strFormatthe number format.
objLocalethe locale for the format. By default the system locale is used.

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:

 

getInstance

static jsx3.util.NumberFormat getInstance(intType : int, objLocale : jsx3.util.Locale)
Returns a number format appropriate for objLocale.

Parameters:

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

Returns:

 

Since:

3.7

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:

 

parse

Number parse(s : String)
Parses a string according to this number format and returns the resulting value. Note: this method ignores any non-significant characters. This method does not handle localized digit characters other than ASCII 0-9.

Parameters:

s

Returns:

 

Since:

3.7

setLocale

void setLocale(objLocale : jsx3.util.Locale)

Parameters:

objLocale

toString

String toString()

Returns:

 

Overrides:

toString in jsx3.lang.Object