com.ibm.icu.text

Class DecimalFormatSymbols

Implemented Interfaces:
Cloneable, Serializable

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.

Authors:
Mark Davis
Alan Liu
See Also:
Locale, DecimalFormat

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

Object
clone()
Standard override.
boolean
equals(Object obj)
Override equals.
Currency
getCurrency()
Returns the currency symbol, for JDK 1.4 compatibility only.
String
getCurrencySymbol()
Return the string denoting the local currency.
char
getDecimalSeparator()
Return the character used for decimal sign.
char
getDigit()
Return the character used for a digit in a pattern.
String
getExponentSeparator()
NEW Return the string used to separate the mantissa from the exponent.
char
getGroupingSeparator()
Return the character used for thousands separator.
String
getInfinity()
Return the String used to represent infinity.
String
getInternationalCurrencySymbol()
Return the international string denoting the local currency.
Locale
getLocale()
Returns the locale for which this object was constructed.
ULocale
getLocale(ULocale.Type type)
Return the locale that was used to create this object, or null.
char
getMinusSign()
Return the character used to represent minus sign.
char
getMonetaryDecimalSeparator()
Return the monetary decimal separator.
String
getNaN()
Return the String used to represent NaN.
char
getPadEscape()
NEW Return the character used to pad numbers out to a specified width.
char
getPatternSeparator()
Return the character used to separate positive and negative subpatterns in a pattern.
char
getPerMill()
Return the character used for mille percent sign.
char
getPercent()
Return the character used for percent sign.
char
getPlusSign()
NEW Return the localized plus sign.
char
getSignificantDigit()
Return the character used to represent a significant digit in a pattern.
ULocale
getULocale()
Returns the locale for which this object was constructed.
char
getZeroDigit()
Return the character used for zero.
int
hashCode()
Override hashCode
void
setCurrency(Currency currency)
ICU does not use the DecimalFormatSymbols for the currency any more.
void
setCurrencySymbol(String currency)
Set the string denoting the local currency.
void
setDecimalSeparator(char decimalSeparator)
Set the character used for decimal sign.
void
setDigit(char digit)
Set the character used for a digit in a pattern.
void
setExponentSeparator(String exp)
NEW Set the string used to separate the mantissa from the exponent.
void
setGroupingSeparator(char groupingSeparator)
Set the character used for thousands separator.
void
setInfinity(String infinity)
Set the String used to represent infinity.
void
setInternationalCurrencySymbol(String currency)
Set the international string denoting the local currency.
void
setMinusSign(char minusSign)
Set the character used to represent minus sign.
void
setMonetaryDecimalSeparator(char sep)
Set the monetary decimal separator.
void
setNaN(String NaN)
Set the String used to represent NaN.
void
setPadEscape(char c)
NEW Set the character used to pad numbers out to a specified width.
void
setPatternSeparator(char patternSeparator)
Set the character used to separate positive and negative subpatterns in a pattern.
void
setPerMill(char perMill)
Set the character used for mille percent sign.
void
setPercent(char percent)
Set the character used for percent sign.
void
setPlusSign(char plus)
NEW Set the localized plus sign.
void
setSignificantDigit(char sigDigit)
Set the character used to represent a significant digit in a pattern.
void
setZeroDigit(char zeroDigit)
Set the character used for zero.

Constructor Details

DecimalFormatSymbols

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

DecimalFormatSymbols

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

DecimalFormatSymbols

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

Method Details

clone

public Object clone()
Standard override.

equals

public boolean equals(Object obj)
Override equals.

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

getCurrencySymbol

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

getDecimalSeparator

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

getDigit

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

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

getGroupingSeparator

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

getInfinity

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

getInternationalCurrencySymbol

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

getLocale

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

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 ULocale.VALID_LOCALE or ULocale.ACTUAL_LOCALE.
Returns:
the information specified by type, or null if this object was not constructed from locale data.

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

getMonetaryDecimalSeparator

public char getMonetaryDecimalSeparator()
Return the monetary decimal separator.
Returns:
the monetary decimal separator character

getNaN

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

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

getPatternSeparator

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

getPerMill

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

getPercent

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

getPlusSign

public char getPlusSign()
NEW Return the localized plus sign.
Returns:
the plus sign, used in localized patterns and formatted strings

getSignificantDigit

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

getULocale

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

getZeroDigit

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

hashCode

public int hashCode()
Override hashCode

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

setCurrencySymbol

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

setDecimalSeparator

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

setDigit

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

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

setGroupingSeparator

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

setInfinity

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

setInternationalCurrencySymbol

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

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

setMonetaryDecimalSeparator

public void setMonetaryDecimalSeparator(char sep)
Set the monetary decimal separator.
Parameters:
sep - the monetary decimal separator character

setNaN

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

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.

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

setPerMill

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

setPercent

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

setPlusSign

public void setPlusSign(char plus)
NEW Set the localized plus sign.
Parameters:
plus - the plus sign, used in localized patterns and formatted strings

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

setZeroDigit

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

Copyright (c) 2006 IBM Corporation and others.