public class PRNumberFormat extends PerThreadCache
See http://oss.software.ibm.com/cgi-bin/icu/lx for an page that permits one to explore the settings supplied for each locale.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT |
static int |
CURRENCY_PRECISION
Use digits to right of dp as specified by currency
|
static java.lang.String |
DEFAULT_CURRENCY
locale-specific default currency format
|
static java.lang.String |
DEFAULT_DECIMAL
locale-specific default decimal format
|
static java.lang.String |
DEFAULT_DURATION
locale-specific default duration format
|
static java.lang.String |
DEFAULT_INTEGER
locale-specific default integer format
|
static java.lang.String |
DEFAULT_ORDINAL
locale-specific default ordinal format
|
static java.lang.String |
DEFAULT_PERCENT
locale-specific default percent format
|
static int |
DEFAULT_PRECISION
Do not set constraints on digits to right of dp.
|
static java.lang.String |
DEFAULT_SPELLOUT
locale-specific default spellout format
|
static java.lang.String |
VERSION |
USE_DEFAULT_TIMEZONE, USE_DEFAULT_TIMEZONE_PRE42SP6
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
format(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
java.lang.String aCurrency,
com.pega.ibm.icu.math.BigDecimal aValue)
Formats the number using the specified pattern and locale.
|
static java.lang.String |
format(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
java.lang.String aCurrency,
double aValue)
Formats the number using the specified pattern and locale.
|
static java.lang.String |
format(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
java.lang.String aCurrency,
int aValue)
Formats the number using the specified pattern and locale.
|
static java.lang.String |
format(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
java.lang.String aCurrency,
int aDigits,
com.pega.ibm.icu.math.BigDecimal aValue)
Formats the number using the specified pattern and locale.
|
static java.lang.String |
format(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
java.lang.String aCurrency,
int aDigits,
com.pega.ibm.icu.math.BigDecimal aValue,
java.math.RoundingMode aMode)
Formats the number using the specified pattern and locale.
|
static java.lang.String |
format(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
java.lang.String aCurrency,
int aDigits,
double aValue)
Formats the number using the specified pattern and locale.
|
static java.lang.String |
format(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
java.lang.String aCurrency,
int aDigits,
double aValue,
java.math.RoundingMode aMode)
Formats the number using the specified pattern and locale.
|
static java.lang.String |
format(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
java.lang.String aCurrency,
int aDigits,
int aValue)
Formats the number using the specified pattern and locale.
|
static java.lang.String |
format(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
java.lang.String aCurrency,
int aDigits,
int aValue,
java.math.RoundingMode aMode)
Formats the number using the specified pattern and locale.
|
static com.pega.ibm.icu.util.Currency |
getCurrency(java.util.Locale aLocale,
java.lang.String aCurrency)
Retrieve the desired currency value.
|
static com.pega.ibm.icu.util.Currency |
getCurrencyByLocale(java.util.Locale aLocale) |
static java.util.Set |
getCurrencyCodesForLocale(java.lang.String aLocaleName)
Returns the ISO currency codes for the specified
aLocaleName
including multi-level fallback. |
static boolean |
isCurrencyValid(java.lang.String isoCode)
validate that a given currency name is valid.
|
static com.pega.ibm.icu.math.BigDecimal |
numberToBigDecimal(java.lang.Number aValue)
Helper function to convert java.lang.Number to ICU BigDecimal,
preserving as much accuracy as possible.
|
static java.lang.Number |
parse(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
boolean aIntegerOnly,
java.lang.String aString)
Parses the String using the specified pattern and locale as a number.
|
static java.lang.Number |
parse(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
java.lang.String aCurrency,
boolean aIntegerOnly,
java.lang.String aString)
Parses the String using the specified pattern and locale as a number.
|
static com.pega.ibm.icu.math.BigDecimal |
parseLocalizedAsBigDecimal(java.lang.String aLocale,
java.lang.String aString)
Convenience method to parse a value as a BigDecimal, using localized formats
|
static double |
parseLocalizedAsDouble(java.lang.String aLocale,
java.lang.String aString)
Convenience method to parse a value as a double, using localized formats
|
static int |
parseLocalizedAsInteger(java.lang.String aLocale,
java.lang.String aString)
Convenience method to parse a value as an integer, using localized formats
|
getDefaultTimeZone, getLocale, getLocaleName, getTimeZone, setDefaultTimeZone
public static final java.lang.String COPYRIGHT
public static final java.lang.String VERSION
public static final java.lang.String DEFAULT_DECIMAL
public static final java.lang.String DEFAULT_INTEGER
public static final java.lang.String DEFAULT_CURRENCY
public static final java.lang.String DEFAULT_PERCENT
public static final java.lang.String DEFAULT_DURATION
public static final java.lang.String DEFAULT_ORDINAL
public static final java.lang.String DEFAULT_SPELLOUT
public static final int CURRENCY_PRECISION
public static final int DEFAULT_PRECISION
public static final java.lang.String format(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, java.lang.String aCurrency, int aValue)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaCurrency
- currency name, if null or blank, the default for the locale is usedaValue
- number to convertpublic static final java.lang.String format(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, java.lang.String aCurrency, int aDigits, int aValue)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaCurrency
- currency name, if null or blank, the default for the locale is usedaDigits
- digits to right of decimal pointaValue
- number to convertpublic static final java.lang.String format(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, java.lang.String aCurrency, int aDigits, int aValue, java.math.RoundingMode aMode)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaCurrency
- currency name, if null or blank, the default for the locale is usedaDigits
- digits to right of decimal pointaValue
- number to convertaMode
- RoundingMode to be appliedpublic static final java.lang.String format(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, java.lang.String aCurrency, double aValue)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaCurrency
- currency name, if null or blank, the default for the locale is usedaValue
- number to convertpublic static final java.lang.String format(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, java.lang.String aCurrency, int aDigits, double aValue)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaCurrency
- currency name, if null or blank, the default for the locale is usedaDigits
- digits to right of decimal pointaValue
- number to convertpublic static final java.lang.String format(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, java.lang.String aCurrency, int aDigits, double aValue, java.math.RoundingMode aMode)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaCurrency
- currency name, if null or blank, the default for the locale is usedaDigits
- digits to right of decimal pointaValue
- number to convertaMode
- RoundingMode to be appliedpublic static final java.lang.String format(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, java.lang.String aCurrency, com.pega.ibm.icu.math.BigDecimal aValue)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaCurrency
- currency name, if null or blank, the default for the locale is usedaValue
- number to convertpublic static final java.lang.String format(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, java.lang.String aCurrency, int aDigits, com.pega.ibm.icu.math.BigDecimal aValue)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaCurrency
- currency name, if null or blank, the default for the locale is usedaDigits
- digits to right of decimal pointaValue
- number to convertpublic static final java.lang.String format(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, java.lang.String aCurrency, int aDigits, com.pega.ibm.icu.math.BigDecimal aValue, java.math.RoundingMode aMode)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaCurrency
- currency name, if null or blank, the default for the locale is usedaDigits
- digits to right of decimal pointaValue
- number to convertaMode
- RoundingMode to be appliedpublic static final java.lang.Number parse(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, boolean aIntegerOnly, java.lang.String aString)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaIntegerOnly
- true
if integer only parse desiredaString
- formatted value to convert to numberjava.lang.NumberFormatException
- if the String could not be convertedpublic static final java.lang.Number parse(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, java.lang.String aCurrency, boolean aIntegerOnly, java.lang.String aString)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaCurrency
- Currency name, selects explicit currency symbols recognized.aIntegerOnly
- true
if integer only parse desiredaString
- formatted value to convert to numberjava.lang.NumberFormatException
- if the String could not be convertedpublic static final int parseLocalizedAsInteger(java.lang.String aLocale, java.lang.String aString)
aLocale
- name of locale whose formats should be usedaString
- String to be parsedjava.lang.NumberFormatException
- if string cannot be parsedpublic static final double parseLocalizedAsDouble(java.lang.String aLocale, java.lang.String aString)
aLocale
- name of locale whose formats should be usedaString
- String to be parsedjava.lang.NumberFormatException
- if string cannot be parsedpublic static final com.pega.ibm.icu.math.BigDecimal parseLocalizedAsBigDecimal(java.lang.String aLocale, java.lang.String aString)
aLocale
- name of locale whose formats should be usedaString
- String to be parsedjava.lang.NumberFormatException
- if string cannot be parsedpublic static final com.pega.ibm.icu.math.BigDecimal numberToBigDecimal(java.lang.Number aValue)
aValue
- Number to be convertedpublic static final com.pega.ibm.icu.util.Currency getCurrency(java.util.Locale aLocale, java.lang.String aCurrency)
aLocale
- Locale to be used (used if aCurrency omitted)aCurrency
- name of Currency desiredpublic static com.pega.ibm.icu.util.Currency getCurrencyByLocale(java.util.Locale aLocale)
public static java.util.Set getCurrencyCodesForLocale(java.lang.String aLocaleName)
aLocaleName
including multi-level fallback. That is, if a currency is not found in the
en_US Currencies data, then the en Currencies data will be returned.aLocaleName
- String
locale nameSet
of String
objects for the ISO 4217
currency codes for the specified localepublic static boolean isCurrencyValid(java.lang.String isoCode)
Adapted from com.ibm.icu.util.Currency. The technique to access currency metadata is icu version specific.
isoCode
- name of currency to validatetrue
if validCopyright © 2018 Pegasystems Inc. All Rights Reserved.