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 DecimalFormatSymbols |
forNumberingSystem(Locale locale,
NumberingSystem ns)
[icu] Returns a DecimalFormatSymbols instance for the given locale with digits and symbols
corresponding to the given
NumberingSystem . |
static DecimalFormatSymbols |
forNumberingSystem(ULocale locale,
NumberingSystem ns)
[icu] Returns a DecimalFormatSymbols instance for the given locale with digits and symbols
corresponding to the given
NumberingSystem . |
String |
getApproximatelySignString()
Deprecated.
This API is for technology preview only.
|
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. |
int |
getCodePointZero()
Deprecated.
This API is ICU internal only.
|
Currency |
getCurrency()
Returns the currency symbol, for
getCurrency() API
compatibility only. |
String |
getCurrencyPattern()
Deprecated.
This API is for ICU internal use only
|
String |
getCurrencySymbol()
Returns the string denoting the local currency.
|
char |
getDecimalSeparator()
Returns the character used for decimal sign.
|
String |
getDecimalSeparatorString()
[icu] 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()
[icu] Returns the array of strings used as digits, in order from 0 through 9
|
String[] |
getDigitStringsLocal()
Deprecated.
This API is ICU internal only.
|
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 grouping separator.
|
String |
getGroupingSeparatorString()
[icu] 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)
[icu] Returns the locale that was used to create this object, or null.
|
char |
getMinusSign()
Returns the character used to represent minus sign.
|
String |
getMinusSignString()
[icu] Returns the string used to represent minus sign.
|
char |
getMonetaryDecimalSeparator()
Returns the monetary decimal separator.
|
String |
getMonetaryDecimalSeparatorString()
[icu] Returns the monetary decimal separator string.
|
char |
getMonetaryGroupingSeparator()
[icu] Returns the monetary grouping separator.
|
String |
getMonetaryGroupingSeparatorString()
[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.
|
String |
getPercentString()
[icu] Returns the string used for percent sign.
|
char |
getPerMill()
Returns the character used for mille percent sign.
|
String |
getPerMillString()
[icu] Returns the string used for permille sign.
|
char |
getPlusSign()
[icu] Returns the localized plus sign.
|
String |
getPlusSignString()
[icu] 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 |
setApproximatelySignString(String approximatelySignString)
Deprecated.
This API is for technology preview only.
|
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)
[icu] 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)
[icu] Sets the array of strings used as digits, in order from 0 through 9
Note:
When the input array of digit strings contains any strings
represented by multiple Java chars, then
getDigits() will return
the default digits ('0' - '9') and getZeroDigit() will return the
default zero digit ('0'). |
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 grouping separator.
|
void |
setGroupingSeparatorString(String groupingSeparatorString)
[icu] 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)
[icu] Sets the string used to represent minus sign.
|
void |
setMonetaryDecimalSeparator(char sep)
Sets the monetary decimal separator.
|
void |
setMonetaryDecimalSeparatorString(String sep)
[icu] Sets the monetary decimal separator string.
|
void |
setMonetaryGroupingSeparator(char sep)
[icu] Sets the monetary grouping separator.
|
void |
setMonetaryGroupingSeparatorString(String sep)
[icu] Sets the monetary grouping separator string.
|
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 |
setPercentString(String percentString)
[icu] Sets the string used for percent sign.
|
void |
setPerMill(char perMill)
Sets the character used for mille percent sign.
|
void |
setPerMillString(String perMillString)
[icu] Sets the string used for permille sign.
|
void |
setPlusSign(char plus)
[icu] Sets the localized plus sign.
|
void |
setPlusSignString(String plusSignString)
[icu] 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
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 DecimalFormatSymbols forNumberingSystem(Locale locale, NumberingSystem ns)
NumberingSystem
.
This method behaves equivalently to 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 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 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()
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()
setDigitStrings(String[])
@Deprecated public String[] getDigitStringsLocal()
WARNING: Mutating the returned array will cause undefined behavior.
If you need to change the value of the array, use getDigitStrings()
and setDigitStrings(java.lang.String[])
instead.
@Deprecated public int getCodePointZero()
public void setDigitStrings(String[] digitStrings)
Note:
When the input array of digit strings contains any strings
represented by multiple Java chars, then getDigits()
will return
the default digits ('0' - '9') and 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.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 charactersetGroupingSeparatorString(String)
public String getGroupingSeparatorString()
setGroupingSeparatorString(String)
public void setGroupingSeparatorString(String groupingSeparatorString)
Note: When the input grouping separator String is represented
by multiple Java chars, then getGroupingSeparator()
will
return the default grouping separator character (',').
groupingSeparatorString
- the grouping separator stringNullPointerException
- if groupingSeparatorString
is null.getGroupingSeparatorString()
public char getDecimalSeparator()
public void setDecimalSeparator(char decimalSeparator)
decimalSeparator
- the decimal characterpublic String getDecimalSeparatorString()
setDecimalSeparatorString(String)
public void setDecimalSeparatorString(String decimalSeparatorString)
Note: When the input decimal separator String is represented
by multiple Java chars, then getDecimalSeparator()
will
return the default decimal separator character ('.').
decimalSeparatorString
- the decimal sign stringNullPointerException
- if decimalSeparatorString
is null.getDecimalSeparatorString()
public char getPerMill()
public void setPerMill(char perMill)
perMill
- the mille percent characterpublic String getPerMillString()
setPerMillString(String)
public void setPerMillString(String perMillString)
Note: When the input permille String is represented
by multiple Java chars, then getPerMill()
will
return the default permille character ('‰').
perMillString
- the permille stringNullPointerException
- if perMillString
is null.getPerMillString()
public char getPercent()
public void setPercent(char percent)
percent
- the percent characterpublic String getPercentString()
setPercentString(String)
public void setPercentString(String percentString)
Note: When the input grouping separator String is represented
by multiple Java chars, then getPercent()
will
return the default percent sign character ('%').
percentString
- the percent stringNullPointerException
- if percentString
is null.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()
setMinusSignString(String)
public void setMinusSignString(String minusSignString)
Note: When the input minus sign String is represented
by multiple Java chars, then getMinusSign()
will
return the default minus sign character ('-').
minusSignString
- the minus sign stringNullPointerException
- if minusSignString
is null.getGroupingSeparatorString()
public char getPlusSign()
setPlusSign(char)
,
setMinusSign(char)
,
getMinusSign()
public void setPlusSign(char plus)
plus
- the plus sign, used in localized patterns and formatted
stringsgetPlusSign()
,
setMinusSign(char)
,
getMinusSign()
public String getPlusSignString()
public void setPlusSignString(String plusSignString)
Note: When the input plus sign String is represented
by multiple Java chars, then getPlusSign()
will
return the default plus sign character ('+').
plusSignString
- the plus sign string, used in localized patterns and formatted
stringsNullPointerException
- if plusSignString
is null.getPlusSignString()
@Deprecated public String getApproximatelySignString()
@Deprecated public void setApproximatelySignString(String approximatelySignString)
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()
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 void setMonetaryDecimalSeparator(char sep)
sep
- the monetary decimal separator characterpublic String getMonetaryDecimalSeparatorString()
setMonetaryDecimalSeparatorString(String)
public void setMonetaryDecimalSeparatorString(String sep)
Note: When the input monetary decimal separator String is represented
by multiple Java chars, then getMonetaryDecimalSeparatorString()
will
return the default monetary decimal separator character ('.').
sep
- the monetary decimal separator stringNullPointerException
- if sep
is null.getMonetaryDecimalSeparatorString()
public char getMonetaryGroupingSeparator()
public void setMonetaryGroupingSeparator(char sep)
sep
- the monetary grouping separator characterpublic String getMonetaryGroupingSeparatorString()
setMonetaryGroupingSeparatorString(String)
public void setMonetaryGroupingSeparatorString(String sep)
Note: When the input grouping separator String is represented
by multiple Java chars, then getMonetaryGroupingSeparator()
will
return the default monetary grouping separator character (',').
sep
- the monetary grouping separator stringNullPointerException
- if sep
is null.getMonetaryGroupingSeparatorString()
@Deprecated public String getCurrencyPattern()
public 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 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.
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 © 2016 Unicode, Inc. and others.