Top Description Inners Fields Constructors Methods
com.ibm.icu.text

public Class DecimalFormatSymbols

extends Object
implements Cloneable, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.lang.Cloneable
Imports
java.io.IOException, .ObjectInputStream, .Serializable, java.util.Arrays, .Locale, .MissingResourceException, com.ibm.icu.impl.CacheBase, .CurrencyData, .CurrencyData.CurrencyDisplayInfo, .CurrencyData.CurrencyFormatInfo, .CurrencyData.CurrencySpacingInfo, .ICUData, .ICUResourceBundle, .SoftCache, .UResource, com.ibm.icu.util.Currency, .ICUCloneNotSupportedException, .ULocale, .ULocale.Category, .UResourceBundle

ICU Enhancement

This class is ICU's replacement for java.text.DecimalFormatSymbols.

ICU

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.
Authors
Mark Davis, Alan Liu
ICU Status
Stable since ICU 2.0.
See Also
java.util.Locale, DecimalFormat

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
DecimalFormatSymbols.DecFmtDataSink

Sink for enumerating all of the decimal format symbols (more specifically, anything under the "NumberElements.symbols" tree).

Field Summary

Modifier and TypeField and Description
private ULocale
actualLocale

The locale containing data used to construct this object, or null.

private String
approximatelyString

The string used to indicate an approximately sign.

private static final CacheBase<ULocale, DecimalFormatSymbols.CacheData, Void>
cachedLocaleData

cache to hold the NumberElements of a Locale.

private transient int
codePointZero

Dealing with code points is faster than dealing with strings when formatting.

private transient Currency
public static final int
public static final int
public static final int
private String
private String[]
private String[]
private String
currencySymbol

String denoting the local currency, e.g. "$".

private static final int
private char
decimalSeparator

Character used for decimal sign.

private String
decimalSeparatorString

String used for decimal sign.

private static final char
private static final char[]
private static final String[]
private static final char
private static final char
private static final char
private static final char
private static final char
private char
digit

Character used for a digit in a pattern.

private char[]
digits

Array of characters used for the digits 0-9 in order.

private String[]
digitStrings

Array of Strings used for the digits 0-9 in order.

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
exponentMultiplicationSign

Exponent multiplication sign.

private String
exponentSeparator

The string used to separate the mantissa from the exponent.

private char
groupingSeparator

Character used for thousands separator.

private String
groupingSeparatorString

String used for thousands separator.

private String
infinity

Character used to represent infinity.

private String
intlCurrencySymbol

International string denoting the local currency, e.g. "USD".

private static final String
LATIN_NUMBERING_SYSTEM

Constants for path names in the data bundles.

private char
minusSign

Character used to represent minus sign.

private String
minusString

String versions of minus sign.

private char
monetaryGroupingSeparator

The grouping separator character used when formatting currency values.

private String
monetaryGroupingSeparatorString

The grouping separator string used when formatting currency values.

private char
monetarySeparator

The decimal separator character used when formatting currency values.

private String
monetarySeparatorString

The decimal separator string used when formatting currency values.

private String
NaN

Character used to represent NaN.

private static final String
private char
padEscape

The character used to indicate a padding character in a format, e.g., '*' in a pattern such as "$*_#,##0.00".

private char
patternSeparator

Character used to separate positive and negative subpatterns in a pattern.

private char
percent

Character used for percent sign.

private String
percentString

String used for percent sign.

private char
perMill

Character used for mille percent sign.

private String
perMillString

String used for mille percent sign.

private char
plusSign

The character used to indicate a plus sign.

private String
plusString

String versions of plus sign.

private Locale
requestedLocale

The locale for which this object was constructed.

private int
serialVersionOnStream

Describes the version of DecimalFormatSymbols present on the stream.

private static final long
private char
sigDigit

Character used for a significant digit in a pattern.

private static final String[]
SYMBOL_DEFAULTS

List of default values for the symbols.

private static final String[]
SYMBOL_KEYS

List of field names to be loaded from the data files.

private static final String
private ULocale
ulocale

The requested ULocale.

private ULocale
validLocale

The most specific locale containing any resource data, or null.

private char
zeroDigit

Character used for zero.

Constructor Summary

AccessConstructor and Description
public
DecimalFormatSymbols()

Creates a DecimalFormatSymbols object for the default FORMAT locale.

public
DecimalFormatSymbols(Locale
the locale
locale
)

Creates a DecimalFormatSymbols object for the given locale.

public
DecimalFormatSymbols(ULocale
the locale
locale
)

ICU

private
private

Method Summary

Modifier and TypeMethod and Description
public Object
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public static DecimalFormatSymbols

Returns:

A DecimalFormatSymbols instance.
forNumberingSystem
(Locale
the locale.
locale
,
NumberingSystem
the numbering system.
ns
)

ICU

public static DecimalFormatSymbols

Returns:

A DecimalFormatSymbols instance.
forNumberingSystem
(ULocale
the locale.
locale
,
NumberingSystem
the numbering system.
ns
)

ICU

public String
getApproximatelySignString()

Deprecated This API is for technology preview only.
public static Locale[]

Returns:

An array of Locales for which localized DecimalFormatSymbols instances are available.
getAvailableLocales
()

Returns an array of all locales for which the getInstance methods of this class can return localized instances.

public static ULocale[]

Returns:

An array of ULocales for which localized DecimalFormatSymbols instances are available.
getAvailableULocales
()

ICU

public int
getCodePointZero()

Deprecated This API is ICU internal only.
If the digit strings array corresponds to a sequence of increasing code points, this method returns the code point corresponding to the first entry in the digit strings array.
public Currency

Returns:

the currency used, or null
getCurrency
()

Returns the currency symbol, for DecimalFormatSymbols#getCurrency() API compatibility only.

public String

Returns:

String currency pattern string
getCurrencyPattern
()

Deprecated This API is for ICU internal use only
Internal API for NumberFormat
public String

Returns:

the local currency String.
getCurrencySymbol
()

Returns the string denoting the local currency.

public char

Returns:

the decimal character
getDecimalSeparator
()

Returns the character used for decimal sign.

public String

Returns:

the decimal sign string
getDecimalSeparatorString
()

ICU

public char

Returns:

the digit pattern character
getDigit
()

Returns the character used for a digit in a pattern.

public char[]

Returns:

The array
getDigits
()

Returns the array of characters used as digits, in order from 0 through 9

public String[]

Returns:

The array of ten digit strings
getDigitStrings
()

ICU

public String[]

Returns:

the array of digit strings
getDigitStringsLocal
()

Deprecated This API is ICU internal only.
Returns the array of strings used as digits, in order from 0 through 9 Package private method - doesn't create a defensively copy.
public String
getExponentMultiplicationSign()

Returns the multiplication sign

public String

Returns:

the localized exponent symbol, used in localized patterns and formatted strings
getExponentSeparator
()

ICU

public char

Returns:

the thousands character
getGroupingSeparator
()

Returns the character used for grouping separator.

public String

Returns:

the grouping separator string
getGroupingSeparatorString
()

ICU

public String

Returns:

the Infinity string
getInfinity
()

Returns the String used to represent infinity.

public static DecimalFormatSymbols

Returns:

A DecimalFormatSymbols instance.
getInstance
()

Returns a DecimalFormatSymbols instance for the default locale.

public static DecimalFormatSymbols

Returns:

A DecimalFormatSymbols instance.
getInstance
(Locale
the locale.
locale
)

Returns a DecimalFormatSymbols instance for the given locale.

public static DecimalFormatSymbols

Returns:

A DecimalFormatSymbols instance.
getInstance
(ULocale
the locale.
locale
)

Returns a DecimalFormatSymbols instance for the given locale.

public String

Returns:

the international string denoting the local currency
getInternationalCurrencySymbol
()

Returns the international string denoting the local currency.

public Locale

Returns:

the locale for which this object was constructed
getLocale
()

Returns the locale for which this object was constructed.

public final ULocale

Returns:

the information specified by type, or null if this object was not constructed from locale data.
getLocale
(ULocale.Type type)

ICU

public char

Returns:

the minus sign character
getMinusSign
()

Returns the character used to represent minus sign.

public String

Returns:

the minus sign string
getMinusSignString
()

ICU

public char

Returns:

the monetary decimal separator character
getMonetaryDecimalSeparator
()

Returns the monetary decimal separator.

public String

Returns:

the monetary decimal separator string
getMonetaryDecimalSeparatorString
()

ICU

public char

Returns:

the monetary grouping separator character
getMonetaryGroupingSeparator
()

ICU

public String

Returns:

the monetary grouping separator string
getMonetaryGroupingSeparatorString
()

ICU

public String

Returns:

the NaN String
getNaN
()

Returns the String used to represent NaN.

public char

Returns:

the character
getPadEscape
()

ICU

public String

Returns:

the value, or null.
getPatternForCurrencySpacing
(int
one of CURRENCY_SPC_CURRENCY_MATCH, CURRENCY_SPC_SURROUNDING_MATCH or CURRENCY_SPC_INSERT
itemType
,
boolean
true to get the beforeCurrency values, false to get the afterCurrency values.
beforeCurrency
)

ICU

public char

Returns:

the pattern separator character
getPatternSeparator
()

Returns the character used to separate positive and negative subpatterns in a pattern.

public char

Returns:

the percent character
getPercent
()

Returns the character used for percent sign.

public String

Returns:

the percent string
getPercentString
()

ICU

public char

Returns:

the mille percent character
getPerMill
()

Returns the character used for mille percent sign.

public String

Returns:

the permille string
getPerMillString
()

ICU

public char

Returns:

the plus sign, used in localized patterns and formatted strings
getPlusSign
()

ICU

public String

Returns:

the plus sign string
getPlusSignString
()

ICU

public char

Returns:

the significant digit pattern character
getSignificantDigit
()

Returns the character used to represent a significant digit in a pattern.

public ULocale

Returns:

the locale for which this object was constructed
getULocale
()

Returns the locale for which this object was constructed.

public char

Returns:

the character
getZeroDigit
()

Returns the character used for zero.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
private void
initialize(ULocale locale, NumberingSystem ns)

Initializes the symbols from the locale data.

private void
private static DecimalFormatSymbols.CacheData
loadData(ULocale locale)

private void
readObject(ObjectInputStream stream)

Reads the default serializable fields, then if serialVersionOnStream is less than 1, initialize monetarySeparator to be the same as decimalSeparator and exponential to be 'E'.

public void
setApproximatelySignString(String approximatelySignString)

Deprecated This API is for technology preview only.
public void
setCurrency(Currency
the new currency to be used
currency
)

Sets the currency.

private void
public void
setCurrencySymbol(String
the local currency String.
currency
)

Sets the string denoting the local currency.

public void
setDecimalSeparator(char
the decimal character
decimalSeparator
)

Sets the character used for decimal sign.

public void
setDecimalSeparatorString(String
the decimal sign string
decimalSeparatorString
)

ICU

public void
setDigit(char
the digit pattern character
digit
)

Sets the character used for a digit in a pattern.

public void
setDigitStrings(String[]
The array of digit strings. The length of the array must be exactly 10.
digitStrings
)

ICU

public void
setExponentMultiplicationSign(String exponentMultiplicationSign)

Sets the multiplication sign

public void
setExponentSeparator(String
the localized exponent symbol, used in localized patterns and formatted strings
exp
)

ICU

public void
setGroupingSeparator(char
the thousands character
groupingSeparator
)

Sets the character used for grouping separator.

public void
setGroupingSeparatorString(String
the grouping separator string
groupingSeparatorString
)

ICU

public void
setInfinity(String
the Infinity String
infinity
)

Sets the String used to represent infinity.

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

Sets the international string denoting the local currency.

pack-priv final void
setLocale(ULocale
the most specific locale containing any resource data, or null
valid
,
ULocale
the locale containing data used to construct this object, or null
actual
)

ICU

public void
setMinusSign(char
the minus sign character
minusSign
)

Sets the character used to represent minus sign.

public void
setMinusSignString(String
the minus sign string
minusSignString
)

ICU

public void
setMonetaryDecimalSeparator(char
the monetary decimal separator character
sep
)

Sets the monetary decimal separator.

public void
setMonetaryDecimalSeparatorString(String
the monetary decimal separator string
sep
)

ICU

public void
setMonetaryGroupingSeparator(char
the monetary grouping separator character
sep
)

ICU

public void
setMonetaryGroupingSeparatorString(String
the monetary grouping separator string
sep
)

ICU

public void
setNaN(String
the NaN String
NaN
)

Sets the String used to represent NaN.

public void
setPadEscape(char c)

ICU

public void
setPatternForCurrencySpacing(int
one of CURRENCY_SPC_CURRENCY_MATCH, CURRENCY_SPC_SURROUNDING_MATCH or CURRENCY_SPC_INSERT
itemType
,
boolean
true if the pattern is for before the currency symbol. false if the pattern is for after it.
beforeCurrency
,
String
string to override current setting; can be null.
pattern
)

ICU

public void
setPatternSeparator(char
the pattern separator character
patternSeparator
)

Sets the character used to separate positive and negative subpatterns in a pattern.

public void
setPercent(char
the percent character
percent
)

Sets the character used for percent sign.

public void
setPercentString(String
the percent string
percentString
)

ICU

public void
setPerMill(char
the mille percent character
perMill
)

Sets the character used for mille percent sign.

public void
setPerMillString(String
the permille string
perMillString
)

ICU

public void
setPlusSign(char
the plus sign, used in localized patterns and formatted strings
plus
)

ICU

public void
setPlusSignString(String
the plus sign string, used in localized patterns and formatted strings
plusSignString
)

ICU

public void
setSignificantDigit(char
the significant digit pattern character
sigDigit
)

Sets the character used to represent a significant digit in a pattern.

public void
setZeroDigit(char
the zero character.
zeroDigit
)

Sets the character used for zero.

Inherited from java.lang.Object:
finalizegetClassnotifynotifyAlltoStringwaitwaitwait