public final class

DecimalFormatSymbols

extends Object
implements Serializable Cloneable
java.lang.Object
   ↳ java.text.DecimalFormatSymbols

Class Overview

Encapsulates the set of symbols (such as the decimal separator, the grouping separator, and so on) needed by DecimalFormat to format numbers. DecimalFormat internally creates 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.

Summary

Public Constructors
DecimalFormatSymbols()
Constructs a new DecimalFormatSymbols containing the symbols for the default locale.
DecimalFormatSymbols(Locale locale)
Constructs a new DecimalFormatSymbols containing the symbols for the specified Locale.
Public Methods
Object clone()
Returns a new DecimalFormatSymbols with the same symbols as this DecimalFormatSymbols.
boolean equals(Object object)
Compares the specified object to this DecimalFormatSymbols and indicates if they are equal.
Currency getCurrency()
Returns the currency.
String getCurrencySymbol()
Returns the currency symbol.
char getDecimalSeparator()
Returns the character which represents the decimal point in a number.
char getDigit()
Returns the character which represents a single digit in a format pattern.
char getGroupingSeparator()
Returns the character used as the thousands separator in a number.
String getInfinity()
Returns the string which represents infinity.
String getInternationalCurrencySymbol()
Returns the international currency symbol.
char getMinusSign()
Returns the minus sign character.
char getMonetaryDecimalSeparator()
Returns the character which represents the decimal point in a monetary value.
String getNaN()
Returns the string which represents NaN.
char getPatternSeparator()
Returns the character which separates the positive and negative patterns in a format pattern.
char getPerMill()
Returns the per mill sign character.
char getPercent()
Returns the percent character.
char getZeroDigit()
Returns the character which represents zero.
int hashCode()
Returns an integer hash code for this object.
void setCurrency(Currency currency)
Sets the currency.
void setCurrencySymbol(String value)
Sets the currency symbol.
void setDecimalSeparator(char value)
Sets the character which represents the decimal point in a number.
void setDigit(char value)
Sets the character which represents a single digit in a format pattern.
void setGroupingSeparator(char value)
Sets the character used as the thousands separator in a number.
void setInfinity(String value)
Sets the string which represents infinity.
void setInternationalCurrencySymbol(String value)
Sets the international currency symbol.
void setMinusSign(char value)
Sets the minus sign character.
void setMonetaryDecimalSeparator(char value)
Sets the character which represents the decimal point in a monetary value.
void setNaN(String value)
Sets the string which represents NaN.
void setPatternSeparator(char value)
Sets the character which separates the positive and negative patterns in a format pattern.
void setPerMill(char value)
Sets the per mill sign character.
void setPercent(char value)
Sets the percent character.
void setZeroDigit(char value)
Sets the character which represents zero.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public DecimalFormatSymbols ()

Constructs a new DecimalFormatSymbols containing the symbols for the default locale. Best practice is to create a DecimalFormat and then to get the DecimalFormatSymbols from that object by calling getDecimalFormatSymbols().

public DecimalFormatSymbols (Locale locale)

Constructs a new DecimalFormatSymbols containing the symbols for the specified Locale. Best practice is to create a DecimalFormat and then to get the DecimalFormatSymbols from that object by calling getDecimalFormatSymbols().

Parameters
locale the locale.

Public Methods

public Object clone ()

Returns a new DecimalFormatSymbols with the same symbols as this DecimalFormatSymbols.

Returns
  • a shallow copy of this DecimalFormatSymbols.
See Also

public boolean equals (Object object)

Compares the specified object to this DecimalFormatSymbols and indicates if they are equal. In order to be equal, object must be an instance of DecimalFormatSymbols and contain the same symbols.

Parameters
object the object to compare with this object.
Returns
  • true if the specified object is equal to this DecimalFormatSymbols; false otherwise.
See Also

public Currency getCurrency ()

Returns the currency.

null is returned if setInternationalCurrencySymbol() has been previously called with a value that is not a valid ISO 4217 currency code.

Returns
  • the currency that was set in the constructor or by calling setCurrency() or setInternationalCurrencySymbol(), or null if an invalid currency was set.

public String getCurrencySymbol ()

Returns the currency symbol.

Returns
  • the currency symbol as string.

public char getDecimalSeparator ()

Returns the character which represents the decimal point in a number.

Returns
  • the decimal separator character.

public char getDigit ()

Returns the character which represents a single digit in a format pattern.

Returns
  • the digit pattern character.

public char getGroupingSeparator ()

Returns the character used as the thousands separator in a number.

Returns
  • the thousands separator character.

public String getInfinity ()

Returns the string which represents infinity.

Returns
  • the infinity symbol as a string.

public String getInternationalCurrencySymbol ()

Returns the international currency symbol.

Returns
  • the international currency symbol as string.

public char getMinusSign ()

Returns the minus sign character.

Returns
  • the minus sign as a character.

public char getMonetaryDecimalSeparator ()

Returns the character which represents the decimal point in a monetary value.

Returns
  • the monetary decimal point as a character.

public String getNaN ()

Returns the string which represents NaN.

Returns
  • the symbol NaN as a string.

public char getPatternSeparator ()

Returns the character which separates the positive and negative patterns in a format pattern.

Returns
  • the pattern separator character.

public char getPerMill ()

Returns the per mill sign character.

Returns
  • the per mill sign character.

public char getPercent ()

Returns the percent character.

Returns
  • the percent character.

public char getZeroDigit ()

Returns the character which represents zero.

Returns
  • the zero character.

public int hashCode ()

Returns an integer hash code for this object. By contract, any two objects for which equals(Object) returns true must return the same hash code value. This means that subclasses of Object usually override both methods or neither method.

Returns
  • this object's hash code.

public void setCurrency (Currency currency)

Sets the currency.

The international currency symbol and the currency symbol are updated, but the min and max number of fraction digits stays the same.

Parameters
currency the new currency.
Throws
NullPointerException if currency is null.

public void setCurrencySymbol (String value)

Sets the currency symbol.

Parameters
value the currency symbol.

public void setDecimalSeparator (char value)

Sets the character which represents the decimal point in a number.

Parameters
value the decimal separator character.

public void setDigit (char value)

Sets the character which represents a single digit in a format pattern.

Parameters
value the digit character.

public void setGroupingSeparator (char value)

Sets the character used as the thousands separator in a number.

Parameters
value the grouping separator character.

public void setInfinity (String value)

Sets the string which represents infinity.

Parameters
value the string representing infinity.

public void setInternationalCurrencySymbol (String value)

Sets the international currency symbol.

The currency and currency symbol are also updated if value is a valid ISO4217 currency code.

The min and max number of fraction digits stay the same.

Parameters
value the currency code.

public void setMinusSign (char value)

Sets the minus sign character.

Parameters
value the minus sign character.

public void setMonetaryDecimalSeparator (char value)

Sets the character which represents the decimal point in a monetary value.

Parameters
value the monetary decimal separator character.

public void setNaN (String value)

Sets the string which represents NaN.

Parameters
value the string representing NaN.

public void setPatternSeparator (char value)

Sets the character which separates the positive and negative patterns in a format pattern.

Parameters
value the pattern separator character.

public void setPerMill (char value)

Sets the per mill sign character.

Parameters
value the per mill character.

public void setPercent (char value)

Sets the percent character.

Parameters
value the percent character.

public void setZeroDigit (char value)

Sets the character which represents zero.

Parameters
value the zero digit character.