public class DecimalFormatSymbols extends Object implements Cloneable, Serializable
java.text.DecimalFormatSymbols
. Methods, fields, and other functionality specific to ICU are labeled '[icu]'.
This class represents the set of symbols (such as the decimal separator, the grouping
separator, and so on) needed by 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 FormModifier and Type | Field and Description |
---|---|
static int |
CURRENCY_SPC_CURRENCY_MATCH
[icu] Indicates the currency match pattern used in
getPatternForCurrencySpacing(int, boolean) . |
static int |
CURRENCY_SPC_INSERT
[icu] Indicates the insertion value used in
getPatternForCurrencySpacing(int, boolean) . |
static int |
CURRENCY_SPC_SURROUNDING_MATCH
[icu] Indicates the surrounding match pattern used in
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)
[icu] Creates a DecimalFormatSymbols object for the given locale.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
boolean |
equals(Object obj) |
static Locale[] |
getAvailableLocales()
Returns an array of all locales for which the
getInstance methods of
this class can return localized instances. |
static ULocale[] |
getAvailableULocales()
[icu] 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
getCurrency() API
compatibility only. |
String |
getCurrencySymbol()
Returns the string denoting the local currency.
|
char |
getDecimalSeparator()
Returns the character 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 |
getExponentMultiplicationSign()
Returns the multiplication sign
|
String |
getExponentSeparator()
[icu] Returns the string used to separate the mantissa from the exponent.
|
char |
getGroupingSeparator()
Returns the character used for thousands 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)
[icu] Returns the locale that was used to create this object, or null.
|
char |
getMinusSign()
Returns the character used to represent minus sign.
|
String |
getMinusString()
Deprecated.
This API is ICU internal only.
|
char |
getMonetaryDecimalSeparator()
Returns the monetary decimal separator.
|
char |
getMonetaryGroupingSeparator()
[icu] Returns the monetary grouping separator.
|
String |
getNaN()
Returns the String used to represent NaN.
|
char |
getPadEscape()
[icu] Returns the character used to pad numbers out to a specified width.
|
String |
getPatternForCurrencySpacing(int itemType,
boolean beforeCurrency)
[icu] 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.
|
char |
getPerMill()
Returns the character used for mille percent sign.
|
char |
getPlusSign()
[icu] Returns the localized plus sign.
|
String |
getPlusString()
Deprecated.
This API is ICU internal only.
|
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 |
setDigit(char digit)
Sets the character used for a digit in a pattern.
|
void |
setExponentMultiplicationSign(String exponentMultiplicationSign)
Sets the multiplication sign
|
void |
setExponentSeparator(String exp)
[icu] Sets the string used to separate the mantissa from the exponent.
|
void |
setGroupingSeparator(char groupingSeparator)
Sets the character used for thousands 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 |
setMonetaryDecimalSeparator(char sep)
Sets the monetary decimal separator.
|
void |
setMonetaryGroupingSeparator(char sep)
Sets the monetary decimal separator.
|
void |
setNaN(String NaN)
Sets the String used to represent NaN.
|
void |
setPadEscape(char c)
[icu] Sets the character used to pad numbers out to a specified width.
|
void |
setPatternForCurrencySpacing(int itemType,
boolean beforeCurrency,
String pattern)
[icu] 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 |
setPerMill(char perMill)
Sets the character used for mille percent sign.
|
void |
setPlusSign(char plus)
[icu] Sets the localized plus sign.
|
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
getPatternForCurrencySpacing(int, boolean)
.public static final int CURRENCY_SPC_SURROUNDING_MATCH
getPatternForCurrencySpacing(int, boolean)
.public static final int CURRENCY_SPC_INSERT
getPatternForCurrencySpacing(int, boolean)
.public DecimalFormatSymbols()
FORMAT
locale.ULocale.Category.FORMAT
public 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 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 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 com.ibm.icu.text.DecimalFormatSymbols(locale)
. ICU currently does
not support DecimalFormatSymbolsProvider
, which was introduced in Java
6.
locale
- the locale.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 Locale
s available for this class. ICU currently
does not support DecimalFormatSymbolsProvider
, which was introduced in
Java 6.
Locale
s 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 ULocale
s available in this class. ICU currently
does not support DecimalFormatSymbolsProvider
, which was introduced in
Java 6.
ULocale
s for which localized
DecimalFormatSymbols
instances are available.public char getZeroDigit()
public char[] getDigits()
public void setZeroDigit(char zeroDigit)
zeroDigit
- the zero character.public char getSignificantDigit()
public void setSignificantDigit(char sigDigit)
sigDigit
- the significant digit pattern characterpublic char getGroupingSeparator()
public void setGroupingSeparator(char groupingSeparator)
groupingSeparator
- the thousands characterpublic char getDecimalSeparator()
public void setDecimalSeparator(char decimalSeparator)
decimalSeparator
- the decimal characterpublic char getPerMill()
public void setPerMill(char perMill)
perMill
- the mille percent characterpublic char getPercent()
public void setPercent(char percent)
percent
- the percent characterpublic 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()
@Deprecated public String getMinusString()
public void setMinusSign(char minusSign)
minusSign
- the minus sign characterpublic 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()
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 nullsetCurrencySymbol(java.lang.String)
,
setInternationalCurrencySymbol(java.lang.String)
public char getMonetaryDecimalSeparator()
public char getMonetaryGroupingSeparator()
public void setMonetaryDecimalSeparator(char sep)
sep
- the monetary decimal separator characterpublic void setMonetaryGroupingSeparator(char sep)
sep
- the monetary decimal separator characterpublic String getExponentMultiplicationSign()
public void setExponentMultiplicationSign(String exponentMultiplicationSign)
public String getExponentSeparator()
setExponentSeparator(java.lang.String)
public void setExponentSeparator(String exp)
exp
- the localized exponent symbol, used in localized patterns
and formatted stringsgetExponentSeparator()
public char getPlusSign()
setPlusSign(char)
,
setMinusSign(char)
,
getMinusSign()
@Deprecated public String getPlusString()
public void setPlusSign(char plus)
plus
- the plus sign, used in localized patterns and formatted
stringsgetPlusSign()
,
setMinusSign(char)
,
getMinusSign()
public char getPadEscape()
setPadEscape(char)
,
DecimalFormat.getFormatWidth()
,
DecimalFormat.getPadPosition()
,
DecimalFormat.getPadCharacter()
public void setPadEscape(char c)
getPadEscape()
,
DecimalFormat.setFormatWidth(int)
,
DecimalFormat.setPadPosition(int)
,
DecimalFormat.setPadCharacter(char)
public String getPatternForCurrencySpacing(int itemType, boolean beforeCurrency)
For more information, see UTS#35 section 5.10.2.
Note: ICU4J does not currently use this information.
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.setPatternForCurrencySpacing(int, boolean, String)
public void setPatternForCurrencySpacing(int itemType, boolean beforeCurrency, String pattern)
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.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
Copyright (c) 2016 IBM Corporation and others.