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.
The "rg" (region override), "nu" (numbering system), and "cu" (currency)
Locale Unicode
extensions are supported which may override values within the symbols.
For both "nu" and "cu", if they are specified in addition to "rg" by the
backing Locale, the respective values from the "nu" and "cu" extension
supersede the implicit ones from the "rg" extension.
java.util.Locale , DecimalFormat
| Modifier and Type | Field and Description |
|---|---|
| private transient Currency | |
| private transient volatile boolean | |
| private String | currencySymbol
String denoting the local currency, e.g. "$". |
| private static final int | |
| private char | decimalSeparator
Character used for decimal sign. |
| private char | digit
Character used for a digit in a pattern. |
| private char | exponential
The character used to distinguish the exponent in a number formatted in exponential notation, e.g. 'E' for a number such as "1.23E45". |
| private String | exponentialSeparator
The string used to separate the mantissa from the exponent. |
| private char | groupingSeparator
Character used for grouping separator. |
| private transient volatile int | hashCode
Cached hash code. |
| private String | infinity
String used to represent infinity. |
| private String | intlCurrencySymbol
ISO 4217 currency code denoting the local currency, e.g. "USD". |
| private transient String | |
| private Locale | locale
The locale of these currency format symbols. |
| private char | minusSign
Character used to represent minus sign. |
| private String | minusSignText
String representation of minus sign, which may include formatting characters, such as BiDi control characters. |
| private char | monetaryGroupingSeparator
The grouping separator used when formatting currency values. |
| private char | monetarySeparator
The decimal separator used when formatting currency values. |
| private String | NaN
String used to represent "not a number". |
| private char | patternSeparator
Character used to separate positive and negative subpatterns in a pattern. |
| private char | percent
Character used for percent sign. |
| private String | percentText
String representation of percent sign, which may include formatting characters, such as BiDi control characters. |
| private char | perMill
Character used for per mille sign. |
| private String | perMillText
String representation of per mille sign, which may include formatting characters, such as BiDi control characters. |
| private int | serialVersionOnStream
Describes the version of |
| pack-priv static final long | |
| private char | zeroDigit
Character used for zero. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | DecimalFormatSymbols(Locale
the desired locale locale)Create a DecimalFormatSymbols object for the given locale. |
| Modifier and Type | Method and Description |
|---|---|
| public Object | |
| public boolean | Returns: true if the specified object is equal to this DecimalFormatSymbolsobject to be compared for equality obj)Overrides java. Compares the specified object with this |
| private char | |
| public static Locale[] | Returns: an array of locales for which localizedDecimalFormatSymbols instances are available.Returns an array of all locales for which the
|
| public Currency | Returns: theCurrency of this DecimalFormatSymbolsReturns the |
| public String | Returns: the currency symbolReturns the currency symbol for the currency of these DecimalFormatSymbols in their locale. |
| public char | Returns: the character used for decimal signGets the character used for decimal sign. |
| public char | Returns: the character used for a digit in a patternGets the character used for a digit in a pattern. |
| pack-priv char | |
| public String | Returns: the exponent separator stringReturns the string used to separate the mantissa from the exponent. |
| public char | Returns: the grouping separatorGets the character used for grouping separator. |
| public String | |
| public static final DecimalFormatSymbols | Returns: aDecimalFormatSymbols instance.Gets the |
| public static final DecimalFormatSymbols | Returns: aDecimalFormatSymbols instance.the desired locale. locale)Gets the |
| public String | Returns: the currency codeReturns the ISO 4217 currency code of the currency of these DecimalFormatSymbols. |
| pack-priv String | |
| public Locale | |
| public char | Returns: the character representing minus signGets the character used to represent minus sign. |
| pack-priv String | Returns: the string representing minus signGets the string used to represent minus sign. |
| public char | Returns: the monetary decimal separatorReturns the monetary decimal separator. |
| public char | Returns: the monetary grouping separatorGets the character used for grouping separator for currencies. |
| public String | Returns: the string representing "not a number"Gets the string used to represent "not a number". |
| public char | Returns: the pattern separatorGets the character used to separate positive and negative subpatterns in a pattern. |
| public char | |
| pack-priv String | |
| public char | Returns: the character used for per mille signGets the character used for per mille sign. |
| pack-priv String | |
| public char | |
| public int | Returns: the hash code for thisDecimalFormatSymbolsOverrides java. Returns the hash code for this |
| private void | |
| private void | |
| private Object[] | |
| private void | readObject(ObjectInputStream stream)
Reads the default serializable fields, provides default values for objects in older serial versions, and initializes non-serializable fields. |
| public void | setCurrency(Currency
the new currency to be used currency)Sets the currency of this |
| public void | setCurrencySymbol(String
the currency symbol currency)Sets the currency symbol for the currency of this
|
| public void | setDecimalSeparator(char
the character used for decimal sign decimalSeparator)Sets the character used for decimal sign. |
| public void | setDigit(char
the character used for a digit in a pattern digit)Sets the character used for a digit in a pattern. |
| pack-priv void | |
| public void | setExponentSeparator(String
the exponent separator string exp)Sets the string used to separate the mantissa from the exponent. |
| public void | setGroupingSeparator(char
the grouping separator groupingSeparator)Sets the character used for grouping separator. |
| public void | setInfinity(String
the string representing infinity infinity)Sets the string used to represent infinity. |
| public void | setInternationalCurrencySymbol(String
the currency code currencyCode)Sets the ISO 4217 currency code of the currency of these DecimalFormatSymbols. |
| public void | setMinusSign(char
the character representing minus sign minusSign)Sets the character used to represent minus sign. |
| pack-priv void | setMinusSignText(String
the character representing minus sign minusSignText)Sets the string used to represent minus sign. |
| public void | setMonetaryDecimalSeparator(char
the monetary decimal separator sep)Sets the monetary decimal separator. |
| public void | setMonetaryGroupingSeparator(char
the monetary grouping separator monetaryGroupingSeparator)Sets the character used for grouping separator for currencies. |
| public void | |
| public void | setPatternSeparator(char
the pattern separator patternSeparator)Sets the character used to separate positive and negative subpatterns in a pattern. |
| public void | setPercent(char
the character used for percent sign percent)Sets the character used for percent sign. |
| pack-priv void | setPercentText(String
the string used for percent sign percentText)Sets the string used for percent sign. |
| public void | setPerMill(char
the character used for per mille sign perMill)Sets the character used for per mille sign. |
| pack-priv void | setPerMillText(String
the string used for per mille sign perMillText)Sets the string used for per mille sign. |
| public void |
| currency | back to summary |
|---|---|
| private transient Currency currency | |
| currencyInitialized | back to summary |
|---|---|
| private transient volatile boolean currencyInitialized | |
| currencySymbol | back to summary |
|---|---|
| private String currencySymbol String denoting the local currency, e.g. "$".
| |
| currentSerialVersion | back to summary |
|---|---|
| private static final int currentSerialVersion | |
| decimalSeparator | back to summary |
|---|---|
| private char decimalSeparator Character used for decimal sign.
| |
| digit | back to summary |
|---|---|
| private char digit Character used for a digit in a pattern.
| |
| exponential | back to summary |
|---|---|
| private char exponential The character used to distinguish the exponent in a number formatted in exponential notation, e.g. 'E' for a number such as "1.23E45". Note that the public API provides no way to set this field, even though it is supported by the implementation and the stream format. The intent is that this will be added to the API in the future.
| |
| exponentialSeparator | back to summary |
|---|---|
| private String exponentialSeparator The string used to separate the mantissa from the exponent. Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.
If both
| |
| groupingSeparator | back to summary |
|---|---|
| private char groupingSeparator Character used for grouping separator.
| |
| hashCode | back to summary |
|---|---|
| private transient volatile int hashCode Cached hash code. | |
| infinity | back to summary |
|---|---|
| private String infinity String used to represent infinity.
| |
| intlCurrencySymbol | back to summary |
|---|---|
| private String intlCurrencySymbol ISO 4217 currency code denoting the local currency, e.g. "USD".
| |
| lenientMinusSigns | back to summary |
|---|---|
| private transient String lenientMinusSigns | |
| locale | back to summary |
|---|---|
| private Locale locale The locale of these currency format symbols.
| |
| minusSign | back to summary |
|---|---|
| private char minusSign Character used to represent minus sign.
| |
| minusSignText | back to summary |
|---|---|
| private String minusSignText String representation of minus sign, which may include
formatting characters, such as BiDi control characters.
The first non-format character of this string is the same as
| |
| monetaryGroupingSeparator | back to summary |
|---|---|
| private char monetaryGroupingSeparator The grouping separator used when formatting currency values.
| |
| monetarySeparator | back to summary |
|---|---|
| private char monetarySeparator The decimal separator used when formatting currency values.
| |
| NaN | back to summary |
|---|---|
| private String NaN String used to represent "not a number".
| |
| patternSeparator | back to summary |
|---|---|
| private char patternSeparator Character used to separate positive and negative subpatterns in a pattern.
| |
| percent | back to summary |
|---|---|
| private char percent Character used for percent sign.
| |
| percentText | back to summary |
|---|---|
| private String percentText String representation of percent sign, which may include
formatting characters, such as BiDi control characters.
The first non-format character of this string is the same as
| |
| perMill | back to summary |
|---|---|
| private char perMill Character used for per mille sign.
| |
| perMillText | back to summary |
|---|---|
| private String perMillText String representation of per mille sign, which may include
formatting characters, such as BiDi control characters.
The first non-format character of this string is the same as
| |
| serialVersionOnStream | back to summary |
|---|---|
| private int serialVersionOnStream Describes the version of
DecimalFormatSymbols, the most recent format
(corresponding to the highest allowable serialVersionOnStream)
is always written.
| |
| serialVersionUID | back to summary |
|---|---|
| pack-priv static final long serialVersionUID
| |
| zeroDigit | back to summary |
|---|---|
| private char zeroDigit Character used for zero.
| |
| DecimalFormatSymbols | back to summary |
|---|---|
| public DecimalFormatSymbols() Create a DecimalFormatSymbols object for the default
This is equivalent to calling
| |
| DecimalFormatSymbols | back to summary |
|---|---|
| public DecimalFormatSymbols(Locale locale) Create a DecimalFormatSymbols object for the given locale.
This constructor can only construct instances for the locales
supported by the Java runtime environment, not for those
supported by installed
NumberFormat.getNumberInstance(Locale.forLanguageTag("th-TH-u-nu-thai"))
This may return a NumberFormat instance with the Thai numbering system,
instead of the Latin numbering system.
| |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. Standard override.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Compares the specified object with this Implementation Specification This method performs an equality check with a notion of class
identity based on
| |
| findNonFormatChar | back to summary |
|---|---|
| private char findNonFormatChar(String src, char defChar) Obtains non-format single character from String | |
| getAvailableLocales | back to summary |
|---|---|
| public static Locale[] getAvailableLocales() Returns an array of all locales for which the
| |
| getCurrency | back to summary |
|---|---|
| public Currency getCurrency() Returns the
| |
| getCurrencySymbol | back to summary |
|---|---|
| public String getCurrencySymbol() Returns the currency symbol for the currency of these DecimalFormatSymbols in their locale.
| |
| getDecimalSeparator | back to summary |
|---|---|
| public char getDecimalSeparator() Gets the character used for decimal sign. Different for French, etc.
| |
| getDigit | back to summary |
|---|---|
| public char getDigit() Gets the character used for a digit in a pattern.
| |
| getExponentialSymbol | back to summary |
|---|---|
| pack-priv char getExponentialSymbol() Returns the character used to separate the mantissa from the exponent. | |
| getExponentSeparator | back to summary |
|---|---|
| public String getExponentSeparator() Returns the string used to separate the mantissa from the exponent. Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.
| |
| getGroupingSeparator | back to summary |
|---|---|
| public char getGroupingSeparator() Gets the character used for grouping separator. Different for French, etc.
| |
| getInfinity | back to summary |
|---|---|
| public String getInfinity() Gets the string used to represent infinity. Almost always left unchanged.
| |
| getInstance | back to summary |
|---|---|
| public static final DecimalFormatSymbols getInstance() Gets the This is equivalent to calling
| |
| getInstance | back to summary |
|---|---|
| public static final DecimalFormatSymbols getInstance(Locale locale) Gets the
NumberFormat.getNumberInstance(Locale.forLanguageTag("th-TH-u-nu-thai"))
This may return a NumberFormat instance with the Thai numbering system,
instead of the Latin numbering system.
| |
| getInternationalCurrencySymbol | back to summary |
|---|---|
| public String getInternationalCurrencySymbol() Returns the ISO 4217 currency code of the currency of these DecimalFormatSymbols.
| |
| getLenientMinusSigns | back to summary |
|---|---|
| pack-priv String getLenientMinusSigns() Returns the lenient minus signs. Multiple lenient minus signs
are concatenated to form the returned string. Each codepoint
in the string is a valid minus sign pattern. If there are no
lenient minus signs defined in this locale,
| |
| getLocale | back to summary |
|---|---|
| public Locale getLocale() Returns locale used to create this instance.
| |
| getMinusSign | back to summary |
|---|---|
| public char getMinusSign() Gets the character used to represent minus sign. If no explicit negative format is specified, one is formed by prefixing minusSign to the positive format.
| |
| getMinusSignText | back to summary |
|---|---|
| pack-priv String getMinusSignText() Gets the string used to represent minus sign. If no explicit negative format is specified, one is formed by prefixing minusSignText to the positive format.
| |
| getMonetaryDecimalSeparator | back to summary |
|---|---|
| public char getMonetaryDecimalSeparator() Returns the monetary decimal separator.
| |
| getMonetaryGroupingSeparator | back to summary |
|---|---|
| public char getMonetaryGroupingSeparator() Gets the character used for grouping separator for currencies.
May be different from
| |
| getNaN | back to summary |
|---|---|
| public String getNaN() Gets the string used to represent "not a number". Almost always left unchanged.
| |
| getPatternSeparator | back to summary |
|---|---|
| public char getPatternSeparator() Gets the character used to separate positive and negative subpatterns in a pattern.
| |
| getPercent | back to summary |
|---|---|
| public char getPercent() Gets the character used for percent sign. Different for Arabic, etc.
| |
| getPercentText | back to summary |
|---|---|
| pack-priv String getPercentText() Gets the string used for percent sign. Different for Arabic, etc.
| |
| getPerMill | back to summary |
|---|---|
| public char getPerMill() Gets the character used for per mille sign. Different for Arabic, etc.
| |
| getPerMillText | back to summary |
|---|---|
| pack-priv String getPerMillText() Gets the string used for per mille sign. Different for Arabic, etc.
| |
| getZeroDigit | back to summary |
|---|---|
| public char getZeroDigit() Gets the character used for zero. Different for Arabic, etc.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Returns the hash code for this Implementation Specification Non-transient instance fields of this class are used to calculate
a hash code value which adheres to the contract defined in
| |
| initialize | back to summary |
|---|---|
| private void initialize(Locale locale) Initializes the symbols from the FormatData resource bundle. | |
| initializeCurrency | back to summary |
|---|---|
| private void initializeCurrency(Locale locale) Lazy initialization for currency related fields | |
| loadNumberData | back to summary |
|---|---|
| private Object[] loadNumberData(Locale locale) | |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException Reads the default serializable fields, provides default values for objects
in older serial versions, and initializes non-serializable fields.
If
| |
| setCurrency | back to summary |
|---|---|
| public void setCurrency(Currency currency) Sets the currency of this
| |
| setCurrencySymbol | back to summary |
|---|---|
| public void setCurrencySymbol(String currency) Sets the currency symbol for the currency of this
| |
| setDecimalSeparator | back to summary |
|---|---|
| public void setDecimalSeparator(char decimalSeparator) Sets the character used for decimal sign. Different for French, etc.
| |
| setDigit | back to summary |
|---|---|
| public void setDigit(char digit) Sets the character used for a digit in a pattern.
| |
| setExponentialSymbol | back to summary |
|---|---|
| pack-priv void setExponentialSymbol(char exp) Sets the character used to separate the mantissa from the exponent. | |
| setExponentSeparator | back to summary |
|---|---|
| public void setExponentSeparator(String exp) Sets the string used to separate the mantissa from the exponent. Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.
| |
| setGroupingSeparator | back to summary |
|---|---|
| public void setGroupingSeparator(char groupingSeparator) Sets the character used for grouping separator. Different for French, etc.
| |
| setInfinity | back to summary |
|---|---|
| public void setInfinity(String infinity) Sets the string used to represent infinity. Almost always left unchanged.
| |
| setInternationalCurrencySymbol | back to summary |
|---|---|
| public void setInternationalCurrencySymbol(String currencyCode) Sets the ISO 4217 currency code of the currency of these
DecimalFormatSymbols.
If the currency code is valid (as defined by
| |
| setMinusSign | back to summary |
|---|---|
| public void setMinusSign(char minusSign) Sets the character used to represent minus sign. If no explicit negative format is specified, one is formed by prefixing minusSign to the positive format.
| |
| setMinusSignText | back to summary |
|---|---|
| pack-priv void setMinusSignText(String minusSignText) Sets the string used to represent minus sign. If no explicit
negative format is specified, one is formed by prefixing
minusSignText to the positive format.
Setting the
| |
| setMonetaryDecimalSeparator | back to summary |
|---|---|
| public void setMonetaryDecimalSeparator(char sep) Sets the monetary decimal separator.
| |
| setMonetaryGroupingSeparator | back to summary |
|---|---|
| public void setMonetaryGroupingSeparator(char monetaryGroupingSeparator) Sets the character used for grouping separator for currencies.
Invocation of this method will not affect the normal
| |
| setNaN | back to summary |
|---|---|
| public void setNaN(String NaN) Sets the string used to represent "not a number". Almost always left unchanged.
| |
| setPatternSeparator | back to summary |
|---|---|
| public void setPatternSeparator(char patternSeparator) Sets the character used to separate positive and negative subpatterns in a pattern.
| |
| setPercent | back to summary |
|---|---|
| public void setPercent(char percent) Sets the character used for percent sign. Different for Arabic, etc.
| |
| setPercentText | back to summary |
|---|---|
| pack-priv void setPercentText(String percentText) Sets the string used for percent sign. Different for Arabic, etc.
Setting the
| |
| setPerMill | back to summary |
|---|---|
| public void setPerMill(char perMill) Sets the character used for per mille sign. Different for Arabic, etc.
| |
| setPerMillText | back to summary |
|---|---|
| pack-priv void setPerMillText(String perMillText) Sets the string used for per mille sign. Different for Arabic, etc.
Setting the
| |
| setZeroDigit | back to summary |
|---|---|
| public void setZeroDigit(char zeroDigit) Sets the character used for zero. Different for Arabic, etc.
| |