com.ibm.icu.text

Class DecimalFormatSymbols

public final class DecimalFormatSymbols extends Object implements Cloneable, Serializable

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.

This is an enhanced version of DecimalFormatSymbols that is based on the standard version in the JDK. New or changed functionality is labeled NEW.

Author: Mark Davis Alan Liu

See Also: java.util.Locale DecimalFormat

UNKNOWN: ICU 2.0

Constructor Summary
DecimalFormatSymbols()
Create a DecimalFormatSymbols object for the default locale.
DecimalFormatSymbols(Locale locale)
Create a DecimalFormatSymbols object for the given locale.
DecimalFormatSymbols(ULocale locale)
Create a DecimalFormatSymbols object for the given locale.
Method Summary
Objectclone()
Standard override.
booleanequals(Object obj)
Override equals.
CurrencygetCurrency()
Returns the currency symbol, for JDK 1.4 compatibility only.
StringgetCurrencySymbol()
Return the string denoting the local currency.
chargetDecimalSeparator()
Return the character used for decimal sign.
chargetDigit()
Return the character used for a digit in a pattern.
StringgetExponentSeparator()
NEW Return the string used to separate the mantissa from the exponent.
chargetGroupingSeparator()
Return the character used for thousands separator.
StringgetInfinity()
Return the String used to represent infinity.
StringgetInternationalCurrencySymbol()
Return the international string denoting the local currency.
LocalegetLocale()
Returns the locale for which this object was constructed.
ULocalegetLocale(ULocale.Type type)
Return the locale that was used to create this object, or null.
chargetMinusSign()
Return the character used to represent minus sign.
chargetMonetaryDecimalSeparator()
Return the monetary decimal separator.
chargetMonetaryGroupingSeparator()
Return the monetary decimal separator.
StringgetNaN()
Return the String used to represent NaN.
chargetPadEscape()
NEW Return the character used to pad numbers out to a specified width.
chargetPatternSeparator()
Return the character used to separate positive and negative subpatterns in a pattern.
chargetPercent()
Return the character used for percent sign.
chargetPerMill()
Return the character used for mille percent sign.
chargetPlusSign()
NEW Return the localized plus sign.
chargetSignificantDigit()
Return the character used to represent a significant digit in a pattern.
ULocalegetULocale()
Returns the locale for which this object was constructed.
chargetZeroDigit()
Return the character used for zero.
inthashCode()
Override hashCode
voidsetCurrency(Currency currency)
ICU does not use the DecimalFormatSymbols for the currency any more.
voidsetCurrencySymbol(String currency)
Set the string denoting the local currency.
voidsetDecimalSeparator(char decimalSeparator)
Set the character used for decimal sign.
voidsetDigit(char digit)
Set the character used for a digit in a pattern.
voidsetExponentSeparator(String exp)
NEW Set the string used to separate the mantissa from the exponent.
voidsetGroupingSeparator(char groupingSeparator)
Set the character used for thousands separator.
voidsetInfinity(String infinity)
Set the String used to represent infinity.
voidsetInternationalCurrencySymbol(String currency)
Set the international string denoting the local currency.
voidsetMinusSign(char minusSign)
Set the character used to represent minus sign.
voidsetMonetaryDecimalSeparator(char sep)
Set the monetary decimal separator.
voidsetMonetaryGroupingSeparator(char sep)
Set the monetary decimal separator.
voidsetNaN(String NaN)
Set the String used to represent NaN.
voidsetPadEscape(char c)
NEW Set the character used to pad numbers out to a specified width.
voidsetPatternSeparator(char patternSeparator)
Set the character used to separate positive and negative subpatterns in a pattern.
voidsetPercent(char percent)
Set the character used for percent sign.
voidsetPerMill(char perMill)
Set the character used for mille percent sign.
voidsetPlusSign(char plus)
NEW Set the localized plus sign.
voidsetSignificantDigit(char sigDigit)
Set the character used to represent a significant digit in a pattern.
voidsetZeroDigit(char zeroDigit)
Set the character used for zero.

Constructor Detail

DecimalFormatSymbols

public DecimalFormatSymbols()
Create a DecimalFormatSymbols object for the default locale.

UNKNOWN: ICU 2.0

DecimalFormatSymbols

public DecimalFormatSymbols(Locale locale)
Create a DecimalFormatSymbols object for the given locale.

Parameters: locale the locale

UNKNOWN: ICU 2.0

DecimalFormatSymbols

public DecimalFormatSymbols(ULocale locale)
Create a DecimalFormatSymbols object for the given locale.

Parameters: locale the locale

UNKNOWN: ICU 3.2 This API might change or be removed in a future release.

Method Detail

clone

public Object clone()
Standard override.

UNKNOWN: ICU 2.0

equals

public boolean equals(Object obj)
Override equals.

UNKNOWN: ICU 2.0

getCurrency

public Currency getCurrency()
Returns the currency symbol, for JDK 1.4 compatibility only. ICU clients should use the Currency API directly.

Returns: the currency used, or null

UNKNOWN: ICU 3.4 This API might change or be removed in a future release.

getCurrencySymbol

public String getCurrencySymbol()
Return the string denoting the local currency.

Returns: the local currency String.

UNKNOWN: ICU 2.0

getDecimalSeparator

public char getDecimalSeparator()
Return the character used for decimal sign. Different for French, etc.

Returns: the decimal character

UNKNOWN: ICU 2.0

getDigit

public char getDigit()
Return the character used for a digit in a pattern.

Returns: the digit pattern character

UNKNOWN: ICU 2.0

getExponentSeparator

public String getExponentSeparator()
NEW Return the string used to separate the mantissa from the exponent. Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.

Returns: the localized exponent symbol, used in localized patterns and formatted strings

See Also: DecimalFormatSymbols

UNKNOWN: ICU 2.0

getGroupingSeparator

public char getGroupingSeparator()
Return the character used for thousands separator. Different for French, etc.

Returns: the thousands character

UNKNOWN: ICU 2.0

getInfinity

public String getInfinity()
Return the String used to represent infinity. Almost always left unchanged.

Returns: the Infinity string

UNKNOWN: ICU 2.0

getInternationalCurrencySymbol

public String getInternationalCurrencySymbol()
Return the international string denoting the local currency.

Returns: the international string denoting the local currency

UNKNOWN: ICU 2.0

getLocale

public Locale getLocale()
Returns the locale for which this object was constructed.

Returns: the locale for which this object was constructed

UNKNOWN: ICU 2.0

getLocale

public final ULocale getLocale(ULocale.Type type)
Return the locale that was used to create this object, or null. This may may differ from the locale requested at the time of this object's creation. For example, if an object is created for locale en_US_CALIFORNIA, the actual data may be drawn from en (the actual locale), and en_US may be the most specific locale that exists (the valid locale).

Note: This method will be implemented in ICU 3.0; ICU 2.8 contains a partial preview implementation. The * actual locale is returned correctly, but the valid locale is not, in most cases.

Parameters: type type of information requested, either VALID_LOCALE or ACTUAL_LOCALE.

Returns: the information specified by type, or null if this object was not constructed from locale data.

See Also: ULocale VALID_LOCALE ACTUAL_LOCALE

UNKNOWN: ICU 2.8 (retain) This API might change or be removed in a future release.

getMinusSign

public char getMinusSign()
Return the character used to represent minus sign. If no explicit negative format is specified, one is formed by prefixing minusSign to the positive format.

Returns: the minus sign character

UNKNOWN: ICU 2.0

getMonetaryDecimalSeparator

public char getMonetaryDecimalSeparator()
Return the monetary decimal separator.

Returns: the monetary decimal separator character

UNKNOWN: ICU 2.0

getMonetaryGroupingSeparator

public char getMonetaryGroupingSeparator()
Return the monetary decimal separator.

Returns: the monetary decimal separator character

UNKNOWN: ICU 3.6 This API might change or be removed in a future release.

getNaN

public String getNaN()
Return the String used to represent NaN. Almost always left unchanged.

Returns: the NaN String

UNKNOWN: ICU 2.0

getPadEscape

public char getPadEscape()
NEW Return the character used to pad numbers out to a specified width. This is not the pad character itself; rather, it is the special pattern character preceding the pad character. In the pattern "*_#,##0", '*' is the pad escape, and '_' is the pad character.

Returns: the character

See Also: DecimalFormatSymbols DecimalFormat DecimalFormat DecimalFormat

UNKNOWN: ICU 2.0

getPatternSeparator

public char getPatternSeparator()
Return the character used to separate positive and negative subpatterns in a pattern.

Returns: the pattern separator character

UNKNOWN: ICU 2.0

getPercent

public char getPercent()
Return the character used for percent sign. Different for Arabic, etc.

Returns: the percent character

UNKNOWN: ICU 2.0

getPerMill

public char getPerMill()
Return the character used for mille percent sign. Different for Arabic, etc.

Returns: the mille percent character

UNKNOWN: ICU 2.0

getPlusSign

public char getPlusSign()
NEW Return the localized plus sign.

Returns: the plus sign, used in localized patterns and formatted strings

See Also: DecimalFormatSymbols DecimalFormatSymbols DecimalFormatSymbols

UNKNOWN: ICU 2.0

getSignificantDigit

public char getSignificantDigit()
Return the character used to represent a significant digit in a pattern.

Returns: the significant digit pattern character

UNKNOWN: ICU 3.0

getULocale

public ULocale getULocale()
Returns the locale for which this object was constructed.

Returns: the locale for which this object was constructed

UNKNOWN: ICU 3.2 This API might change or be removed in a future release.

getZeroDigit

public char getZeroDigit()
Return the character used for zero. Different for Arabic, etc.

Returns: the character

UNKNOWN: ICU 2.0

hashCode

public int hashCode()
Override hashCode

UNKNOWN: ICU 2.0

setCurrency

public void setCurrency(Currency currency)
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.

Parameters: currency the new currency to be used

Throws: NullPointerException if currency is null

See Also: DecimalFormatSymbols DecimalFormatSymbols

UNKNOWN: ICU 3.4 This API might change or be removed in a future release.

setCurrencySymbol

public void setCurrencySymbol(String currency)
Set the string denoting the local currency.

Parameters: currency the local currency String.

UNKNOWN: ICU 2.0

setDecimalSeparator

public void setDecimalSeparator(char decimalSeparator)
Set the character used for decimal sign. Different for French, etc.

Parameters: decimalSeparator the decimal character

UNKNOWN: ICU 2.0

setDigit

public void setDigit(char digit)
Set the character used for a digit in a pattern.

Parameters: digit the digit pattern character

UNKNOWN: ICU 2.0

setExponentSeparator

public void setExponentSeparator(String exp)
NEW Set the string used to separate the mantissa from the exponent. Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.

Parameters: exp the localized exponent symbol, used in localized patterns and formatted strings

See Also: DecimalFormatSymbols

UNKNOWN: ICU 2.0

setGroupingSeparator

public void setGroupingSeparator(char groupingSeparator)
Set the character used for thousands separator. Different for French, etc.

Parameters: groupingSeparator the thousands character

UNKNOWN: ICU 2.0

setInfinity

public void setInfinity(String infinity)
Set the String used to represent infinity. Almost always left unchanged.

Parameters: infinity the Infinity String

UNKNOWN: ICU 2.0

setInternationalCurrencySymbol

public void setInternationalCurrencySymbol(String currency)
Set the international string denoting the local currency.

Parameters: currency the international string denoting the local currency.

UNKNOWN: ICU 2.0

setMinusSign

public void setMinusSign(char minusSign)
Set the character used to represent minus sign. If no explicit negative format is specified, one is formed by prefixing minusSign to the positive format.

Parameters: minusSign the minus sign character

UNKNOWN: ICU 2.0

setMonetaryDecimalSeparator

public void setMonetaryDecimalSeparator(char sep)
Set the monetary decimal separator.

Parameters: sep the monetary decimal separator character

UNKNOWN: ICU 2.0

setMonetaryGroupingSeparator

public void setMonetaryGroupingSeparator(char sep)
Set the monetary decimal separator.

Parameters: sep the monetary decimal separator character

UNKNOWN: ICU 3.6 This API might change or be removed in a future release.

setNaN

public void setNaN(String NaN)
Set the String used to represent NaN. Almost always left unchanged.

Parameters: NaN the NaN String

UNKNOWN: ICU 2.0

setPadEscape

public void setPadEscape(char c)
NEW Set the character used to pad numbers out to a specified width. This is not the pad character itself; rather, it is the special pattern character preceding the pad character. In the pattern "*_#,##0", '*' is the pad escape, and '_' is the pad character.

See Also: DecimalFormatSymbols DecimalFormat DecimalFormat DecimalFormat

UNKNOWN: ICU 2.0

setPatternSeparator

public void setPatternSeparator(char patternSeparator)
Set the character used to separate positive and negative subpatterns in a pattern.

Parameters: patternSeparator the pattern separator character

UNKNOWN: ICU 2.0

setPercent

public void setPercent(char percent)
Set the character used for percent sign. Different for Arabic, etc.

Parameters: percent the percent character

UNKNOWN: ICU 2.0

setPerMill

public void setPerMill(char perMill)
Set the character used for mille percent sign. Different for Arabic, etc.

Parameters: perMill the mille percent character

UNKNOWN: ICU 2.0

setPlusSign

public void setPlusSign(char plus)
NEW Set the localized plus sign.

Parameters: plus the plus sign, used in localized patterns and formatted strings

See Also: DecimalFormatSymbols DecimalFormatSymbols DecimalFormatSymbols

UNKNOWN: ICU 2.0

setSignificantDigit

public void setSignificantDigit(char sigDigit)
Set the character used to represent a significant digit in a pattern.

Parameters: sigDigit the significant digit pattern character

UNKNOWN: ICU 3.0

setZeroDigit

public void setZeroDigit(char zeroDigit)
Set the character used for zero.

Parameters: zeroDigit the zero character.

UNKNOWN: ICU 2.0

Copyright (c) 2007 IBM Corporation and others.