public class DecimalFormatSymbols extends Object implements Cloneable, Serializable
DecimalFormat to format
numbers. DecimalFormat creates for itself an instance of
DecimalFormatSymbols from its locale data. If you need to change any of
these symbols, you can get the DecimalFormatSymbols object from your
DecimalFormat and modify it.Locale,
DecimalFormat,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static int |
CURRENCY_SPC_CURRENCY_MATCH
Indicates the currency match pattern used in
DecimalFormatSymbols.getPatternForCurrencySpacing(int, boolean). |
static int |
CURRENCY_SPC_INSERT
Indicates the insertion value used in
DecimalFormatSymbols.getPatternForCurrencySpacing(int, boolean). |
static int |
CURRENCY_SPC_SURROUNDING_MATCH
Indicates the surrounding match pattern used in
DecimalFormatSymbols.getPatternForCurrencySpacing(int, boolean). |
| Constructor and Description |
|---|
DecimalFormatSymbols()
Creates a DecimalFormatSymbols object for the default
FORMAT locale. |
DecimalFormatSymbols(Locale locale)
Creates a DecimalFormatSymbols object for the given locale.
|
DecimalFormatSymbols(ULocale locale)
Creates a DecimalFormatSymbols object for the given locale.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
clone() |
boolean |
equals(Object obj) |
static DecimalFormatSymbols |
forNumberingSystem(Locale locale,
NumberingSystem ns)
Returns a DecimalFormatSymbols instance for the given locale with digits and symbols
corresponding to the given
NumberingSystem. |
static DecimalFormatSymbols |
forNumberingSystem(ULocale locale,
NumberingSystem ns)
Returns a DecimalFormatSymbols instance for the given locale with digits and symbols
corresponding to the given
NumberingSystem. |
static Locale[] |
getAvailableLocales()
Returns an array of all locales for which the
getInstance methods of
this class can return localized instances. |
static ULocale[] |
getAvailableULocales()
Returns an array of all locales for which the
getInstance
methods of this class can return localized instances. |
Currency |
getCurrency()
Returns the currency symbol, for
DecimalFormatSymbols.getCurrency() API
compatibility only. |
String |
getCurrencySymbol()
Returns the string denoting the local currency.
|
char |
getDecimalSeparator()
Returns the character used for decimal sign.
|
String |
getDecimalSeparatorString()
Returns the string used for decimal sign.
|
char |
getDigit()
Returns the character used for a digit in a pattern.
|
char[] |
getDigits()
Returns the array of characters used as digits, in order from 0 through 9
|
String[] |
getDigitStrings()
Returns the array of strings used as digits, in order from 0 through 9
|
String |
getExponentMultiplicationSign()
Returns the multiplication sign
|
String |
getExponentSeparator()
Returns the string used to separate the mantissa from the exponent.
|
char |
getGroupingSeparator()
Returns the character used for grouping separator.
|
String |
getGroupingSeparatorString()
Returns the string used for grouping separator.
|
String |
getInfinity()
Returns the String used to represent infinity.
|
static DecimalFormatSymbols |
getInstance()
Returns a DecimalFormatSymbols instance for the default locale.
|
static DecimalFormatSymbols |
getInstance(Locale locale)
Returns a DecimalFormatSymbols instance for the given locale.
|
static DecimalFormatSymbols |
getInstance(ULocale locale)
Returns a DecimalFormatSymbols instance for the given locale.
|
String |
getInternationalCurrencySymbol()
Returns the international string denoting the local currency.
|
Locale |
getLocale()
Returns the locale for which this object was constructed.
|
ULocale |
getLocale(ULocale.Type type)
Returns the locale that was used to create this object, or null.
|
char |
getMinusSign()
Returns the character used to represent minus sign.
|
String |
getMinusSignString()
Returns the string used to represent minus sign.
|
char |
getMonetaryDecimalSeparator()
Returns the monetary decimal separator.
|
String |
getMonetaryDecimalSeparatorString()
Returns the monetary decimal separator string.
|
char |
getMonetaryGroupingSeparator()
Returns the monetary grouping separator.
|
String |
getMonetaryGroupingSeparatorString()
Returns the monetary grouping separator.
|
String |
getNaN()
Returns the String used to represent NaN.
|
char |
getPadEscape()
Returns the character used to pad numbers out to a specified width.
|
String |
getPatternForCurrencySpacing(int itemType,
boolean beforeCurrency)
Returns the desired currency spacing value.
|
char |
getPatternSeparator()
Returns the character used to separate positive and negative subpatterns
in a pattern.
|
char |
getPercent()
Returns the character used for percent sign.
|
String |
getPercentString()
Returns the string used for percent sign.
|
char |
getPerMill()
Returns the character used for mille percent sign.
|
String |
getPerMillString()
Returns the string used for permille sign.
|
char |
getPlusSign()
Returns the localized plus sign.
|
String |
getPlusSignString()
Returns the string used to represent plus sign.
|
char |
getSignificantDigit()
Returns the character used to represent a significant digit in a pattern.
|
ULocale |
getULocale()
Returns the locale for which this object was constructed.
|
char |
getZeroDigit()
Returns the character used for zero.
|
int |
hashCode() |
void |
setCurrency(Currency currency)
Sets the currency.
|
void |
setCurrencySymbol(String currency)
Sets the string denoting the local currency.
|
void |
setDecimalSeparator(char decimalSeparator)
Sets the character used for decimal sign.
|
void |
setDecimalSeparatorString(String decimalSeparatorString)
Sets the string used for decimal sign.
|
void |
setDigit(char digit)
Sets the character used for a digit in a pattern.
|
void |
setDigitStrings(String[] digitStrings)
Sets the array of strings used as digits, in order from 0 through 9
|
void |
setExponentMultiplicationSign(String exponentMultiplicationSign)
Sets the multiplication sign
|
void |
setExponentSeparator(String exp)
Sets the string used to separate the mantissa from the exponent.
|
void |
setGroupingSeparator(char groupingSeparator)
Sets the character used for grouping separator.
|
void |
setGroupingSeparatorString(String groupingSeparatorString)
Sets the string used for grouping separator.
|
void |
setInfinity(String infinity)
Sets the String used to represent infinity.
|
void |
setInternationalCurrencySymbol(String currency)
Sets the international string denoting the local currency.
|
void |
setMinusSign(char minusSign)
Sets the character used to represent minus sign.
|
void |
setMinusSignString(String minusSignString)
Sets the string used to represent minus sign.
|
void |
setMonetaryDecimalSeparator(char sep)
Sets the monetary decimal separator.
|
void |
setMonetaryDecimalSeparatorString(String sep)
Sets the monetary decimal separator string.
|
void |
setMonetaryGroupingSeparator(char sep)
Sets the monetary grouping separator.
|
void |
setMonetaryGroupingSeparatorString(String sep)
Sets the monetary grouping separator string.
|
void |
setNaN(String NaN)
Sets the String used to represent NaN.
|
void |
setPadEscape(char c)
Sets the character used to pad numbers out to a specified width.
|
void |
setPatternForCurrencySpacing(int itemType,
boolean beforeCurrency,
String pattern)
Sets the indicated currency spacing pattern or value.
|
void |
setPatternSeparator(char patternSeparator)
Sets the character used to separate positive and negative subpatterns
in a pattern.
|
void |
setPercent(char percent)
Sets the character used for percent sign.
|
void |
setPercentString(String percentString)
Sets the string used for percent sign.
|
void |
setPerMill(char perMill)
Sets the character used for mille percent sign.
|
void |
setPerMillString(String perMillString)
Sets the string used for permille sign.
|
void |
setPlusSign(char plus)
Sets the localized plus sign.
|
void |
setPlusSignString(String plusSignString)
Sets the localized plus sign string.
|
void |
setSignificantDigit(char sigDigit)
Sets the character used to represent a significant digit in a pattern.
|
void |
setZeroDigit(char zeroDigit)
Sets the character used for zero.
|
public static final int CURRENCY_SPC_CURRENCY_MATCH
DecimalFormatSymbols.getPatternForCurrencySpacing(int, boolean).public static final int CURRENCY_SPC_SURROUNDING_MATCH
DecimalFormatSymbols.getPatternForCurrencySpacing(int, boolean).public static final int CURRENCY_SPC_INSERT
DecimalFormatSymbols.getPatternForCurrencySpacing(int, boolean).public DecimalFormatSymbols()
FORMAT locale.ULocale.Category.FORMATpublic DecimalFormatSymbols(Locale locale)
locale - the localepublic DecimalFormatSymbols(ULocale locale)
locale - the localepublic static DecimalFormatSymbols getInstance()
Note: Unlike
java.text.DecimalFormatSymbols#getInstance, this method simply returns
new org.graalvm.shadowed.com.ibm.icu.text.DecimalFormatSymbols(). ICU currently does not
support DecimalFormatSymbolsProvider, which was introduced in Java 6.
public static DecimalFormatSymbols getInstance(Locale locale)
Note: Unlike
java.text.DecimalFormatSymbols#getInstance, this method simply returns
new org.graalvm.shadowed.com.ibm.icu.text.DecimalFormatSymbols(locale). ICU currently does
not support DecimalFormatSymbolsProvider, which was introduced in Java
6.
locale - the locale.public static DecimalFormatSymbols getInstance(ULocale locale)
Note: Unlike
java.text.DecimalFormatSymbols#getInstance, this method simply returns
new org.graalvm.shadowed.com.ibm.icu.text.DecimalFormatSymbols(locale). ICU currently does
not support DecimalFormatSymbolsProvider, which was introduced in Java
6.
locale - the locale.public static DecimalFormatSymbols forNumberingSystem(Locale locale, NumberingSystem ns)
NumberingSystem.
This method behaves equivalently to DecimalFormatSymbols.getInstance() called with a locale having a
"numbers=xxxx" keyword specifying the numbering system by name.
In this method, the NumberingSystem argument will be used even if the locale has its own "numbers=xxxx" keyword.
locale - the locale.ns - the numbering system.public static DecimalFormatSymbols forNumberingSystem(ULocale locale, NumberingSystem ns)
NumberingSystem.
This method behaves equivalently to DecimalFormatSymbols.getInstance() called with a locale having a
"numbers=xxxx" keyword specifying the numbering system by name.
In this method, the NumberingSystem argument will be used even if the locale has its own "numbers=xxxx" keyword.
locale - the locale.ns - the numbering system.public static Locale[] getAvailableLocales()
getInstance methods of
this class can return localized instances.
Note: Unlike
java.text.DecimalFormatSymbols#getAvailableLocales, this method simply
returns the array of Locales available for this class. ICU currently
does not support DecimalFormatSymbolsProvider, which was introduced in
Java 6.
Locales for which localized
DecimalFormatSymbols instances are available.public static ULocale[] getAvailableULocales()
getInstance
methods of this class can return localized instances.
Note: Unlike
java.text.DecimalFormatSymbols#getAvailableLocales, this method simply
returns the array of ULocales available in this class. ICU currently
does not support DecimalFormatSymbolsProvider, which was introduced in
Java 6.
ULocales for which localized
DecimalFormatSymbols instances are available.public char getZeroDigit()
public char[] getDigits()
DecimalFormatSymbols.getDigitStrings()public void setZeroDigit(char zeroDigit)
Note: This method propagates digit 1 to digit 9 by incrementing code point one by one.
zeroDigit - the zero character.public String[] getDigitStrings()
DecimalFormatSymbols.setDigitStrings(String[])public void setDigitStrings(String[] digitStrings)
Note:
When the input array of digit strings contains any strings
represented by multiple Java chars, then DecimalFormatSymbols.getDigits() will return
the default digits ('0' - '9') and DecimalFormatSymbols.getZeroDigit() will return the
default zero digit ('0').
digitStrings - The array of digit strings. The length of the array must be exactly 10.NullPointerException - if the digitStrings is null.IllegalArgumentException - if the length of the array is not 10.DecimalFormatSymbols.getDigitStrings()public char getSignificantDigit()
public void setSignificantDigit(char sigDigit)
sigDigit - the significant digit pattern characterpublic char getGroupingSeparator()
public void setGroupingSeparator(char groupingSeparator)
groupingSeparator - the thousands characterDecimalFormatSymbols.setGroupingSeparatorString(String)public String getGroupingSeparatorString()
DecimalFormatSymbols.setGroupingSeparatorString(String)public void setGroupingSeparatorString(String groupingSeparatorString)
Note: When the input grouping separator String is represented
by multiple Java chars, then DecimalFormatSymbols.getGroupingSeparator() will
return the default grouping separator character (',').
groupingSeparatorString - the grouping separator stringNullPointerException - if groupingSeparatorString is null.DecimalFormatSymbols.getGroupingSeparatorString()public char getDecimalSeparator()
public void setDecimalSeparator(char decimalSeparator)
decimalSeparator - the decimal characterpublic String getDecimalSeparatorString()
DecimalFormatSymbols.setDecimalSeparatorString(String)public void setDecimalSeparatorString(String decimalSeparatorString)
Note: When the input decimal separator String is represented
by multiple Java chars, then DecimalFormatSymbols.getDecimalSeparator() will
return the default decimal separator character ('.').
decimalSeparatorString - the decimal sign stringNullPointerException - if decimalSeparatorString is null.DecimalFormatSymbols.getDecimalSeparatorString()public char getPerMill()
public void setPerMill(char perMill)
perMill - the mille percent characterpublic String getPerMillString()
DecimalFormatSymbols.setPerMillString(String)public void setPerMillString(String perMillString)
Note: When the input permille String is represented
by multiple Java chars, then DecimalFormatSymbols.getPerMill() will
return the default permille character ('‰').
perMillString - the permille stringNullPointerException - if perMillString is null.DecimalFormatSymbols.getPerMillString()public char getPercent()
public void setPercent(char percent)
percent - the percent characterpublic String getPercentString()
DecimalFormatSymbols.setPercentString(String)public void setPercentString(String percentString)
Note: When the input grouping separator String is represented
by multiple Java chars, then DecimalFormatSymbols.getPercent() will
return the default percent sign character ('%').
percentString - the percent stringNullPointerException - if percentString is null.DecimalFormatSymbols.getPercentString()public char getDigit()
public void setDigit(char digit)
digit - the digit pattern characterpublic char getPatternSeparator()
public void setPatternSeparator(char patternSeparator)
patternSeparator - the pattern separator characterpublic String getInfinity()
public void setInfinity(String infinity)
infinity - the Infinity Stringpublic String getNaN()
public void setNaN(String NaN)
NaN - the NaN Stringpublic char getMinusSign()
public void setMinusSign(char minusSign)
minusSign - the minus sign characterpublic String getMinusSignString()
DecimalFormatSymbols.setMinusSignString(String)public void setMinusSignString(String minusSignString)
Note: When the input minus sign String is represented
by multiple Java chars, then DecimalFormatSymbols.getMinusSign() will
return the default minus sign character ('-').
minusSignString - the minus sign stringNullPointerException - if minusSignString is null.DecimalFormatSymbols.getGroupingSeparatorString()public char getPlusSign()
DecimalFormatSymbols.setPlusSign(char),
DecimalFormatSymbols.setMinusSign(char),
DecimalFormatSymbols.getMinusSign()public void setPlusSign(char plus)
plus - the plus sign, used in localized patterns and formatted
stringsDecimalFormatSymbols.getPlusSign(),
DecimalFormatSymbols.setMinusSign(char),
DecimalFormatSymbols.getMinusSign()public String getPlusSignString()
public void setPlusSignString(String plusSignString)
Note: When the input plus sign String is represented
by multiple Java chars, then DecimalFormatSymbols.getPlusSign() will
return the default plus sign character ('+').
plusSignString - the plus sign string, used in localized patterns and formatted
stringsNullPointerException - if plusSignString is null.DecimalFormatSymbols.getPlusSignString()public String getCurrencySymbol()
public void setCurrencySymbol(String currency)
currency - the local currency String.public String getInternationalCurrencySymbol()
public void setInternationalCurrencySymbol(String currency)
currency - the international string denoting the local currency.public Currency getCurrency()
DecimalFormatSymbols.getCurrency() API
compatibility only. ICU clients should use the Currency API directly.public void setCurrency(Currency currency)
Note: ICU does not use the DecimalFormatSymbols for the currency any more. This API is present for API compatibility only.
This also sets the currency symbol attribute to the currency's symbol in the DecimalFormatSymbols' locale, and the international currency symbol attribute to the currency's ISO 4217 currency code.
currency - the new currency to be usedNullPointerException - if currency is nullDecimalFormatSymbols.setCurrencySymbol(java.lang.String),
DecimalFormatSymbols.setInternationalCurrencySymbol(java.lang.String)public char getMonetaryDecimalSeparator()
public void setMonetaryDecimalSeparator(char sep)
sep - the monetary decimal separator characterpublic String getMonetaryDecimalSeparatorString()
DecimalFormatSymbols.setMonetaryDecimalSeparatorString(String)public void setMonetaryDecimalSeparatorString(String sep)
Note: When the input monetary decimal separator String is represented
by multiple Java chars, then DecimalFormatSymbols.getMonetaryDecimalSeparatorString() will
return the default monetary decimal separator character ('.').
sep - the monetary decimal separator stringNullPointerException - if sep is null.DecimalFormatSymbols.getMonetaryDecimalSeparatorString()public char getMonetaryGroupingSeparator()
public void setMonetaryGroupingSeparator(char sep)
sep - the monetary grouping separator characterpublic String getMonetaryGroupingSeparatorString()
DecimalFormatSymbols.setMonetaryGroupingSeparatorString(String)public void setMonetaryGroupingSeparatorString(String sep)
Note: When the input grouping separator String is represented
by multiple Java chars, then DecimalFormatSymbols.getMonetaryGroupingSeparator() will
return the default monetary grouping separator character (',').
sep - the monetary grouping separator stringNullPointerException - if sep is null.DecimalFormatSymbols.getMonetaryGroupingSeparatorString()public String getExponentMultiplicationSign()
public void setExponentMultiplicationSign(String exponentMultiplicationSign)
public String getExponentSeparator()
DecimalFormatSymbols.setExponentSeparator(java.lang.String)public void setExponentSeparator(String exp)
exp - the localized exponent symbol, used in localized patterns
and formatted stringsDecimalFormatSymbols.getExponentSeparator()public char getPadEscape()
DecimalFormatSymbols.setPadEscape(char),
DecimalFormat.getFormatWidth(),
DecimalFormat.getPadPosition(),
DecimalFormat.getPadCharacter()public void setPadEscape(char c)
public String getPatternForCurrencySpacing(int itemType, boolean beforeCurrency)
For more information, see UTS#35 section 5.10.2.
itemType - one of CURRENCY_SPC_CURRENCY_MATCH, CURRENCY_SPC_SURROUNDING_MATCH
or CURRENCY_SPC_INSERTbeforeCurrency - true to get the beforeCurrency values, false
to get the afterCurrency values.DecimalFormatSymbols.setPatternForCurrencySpacing(int, boolean, String)public void setPatternForCurrencySpacing(int itemType,
boolean beforeCurrency,
String pattern)
DecimalFormatSymbols.getPatternForCurrencySpacing(int, boolean) for more information.
Values for currency match and surrounding match must be UnicodeSet patterns. Values for insert can be any string.
Note: ICU4J does not currently use this information.
itemType - one of CURRENCY_SPC_CURRENCY_MATCH, CURRENCY_SPC_SURROUNDING_MATCH
or CURRENCY_SPC_INSERTbeforeCurrency - true if the pattern is for before the currency symbol.
false if the pattern is for after it.pattern - string to override current setting; can be null.DecimalFormatSymbols.getPatternForCurrencySpacing(int, boolean)public Locale getLocale()
public ULocale getULocale()
public final ULocale getLocale(ULocale.Type type)
Note: The actual locale is returned correctly, but the valid locale is not, in most cases.
type - type of information requested, either ULocale.VALID_LOCALE or ULocale.ACTUAL_LOCALE.ULocale,
ULocale.VALID_LOCALE,
ULocale.ACTUAL_LOCALE