DecimalFormat.DecimalFormat

DecimalFormat.DecimalFormat

Class Overview | Class Members | This Package | All Packages

Syntax 1
public DecimalFormat()
Description
Create a DecimalFormat using the default pattern and symbols for the default locale. This is a convenient way to obtain a DecimalFormat when internationalization is not the main concern.

To obtain standard formats for a given locale, use the factory methods on NumberFormat such as getNumberInstance. These factories will return the most appropriate sub-class of NumberFormat for a given locale.

See Also
getInstance, getNumberInstance, getCurrencyInstance, getPercentInstance



Syntax 2
public DecimalFormat( String pattern )
Parameters
pattern
A non-localized pattern string.
Description
Create a DecimalFormat from the given pattern and the symbols for the default locale. This is a convenient way to obtain a DecimalFormat when internationalization is not the main concern.

To obtain standard formats for a given locale, use the factory methods on NumberFormat such as getNumberInstance. These factories will return the most appropriate sub-class of NumberFormat for a given locale.

Exceptions
IllegalArgumentException if the given pattern is invalid.
See Also
getInstance, getNumberInstance, getCurrencyInstance, getPercentInstance



Syntax 3
public DecimalFormat( String pattern, DecimalFormatSymbols symbols )
Parameters
pattern
a non-localized pattern string
symbols
the set of symbols to be used
Description
Create a DecimalFormat from the given pattern and symbols. Use this constructor when you need to completely customize the behavior of the format.

To obtain standard formats for a given locale, use the factory methods on NumberFormat such as getInstance or getCurrencyInstance. If you need only minor adjustments to a standard format, you can modify the format returned by a NumberFormat factory method.

Exceptions
IllegalArgumentException if the given pattern is invalid
See Also
getInstance, getNumberInstance, getCurrencyInstance, getPercentInstance, DecimalFormatSymbols