java.text
Class DecimalFormat
- Cloneable, Serializable
DecimalFormat() - Constructs a
DecimalFormat which uses the default
pattern and symbols.
|
DecimalFormat(String pattern) - Constructs a
DecimalFormat which uses the given
pattern and the default symbols for formatting and parsing.
|
DecimalFormat(String pattern, DecimalFormatSymbols symbols) - Constructs a
DecimalFormat using the given pattern
and formatting symbols.
|
equals , format , format , format , format , format , getAvailableLocales , getCurrency , getCurrencyInstance , getCurrencyInstance , getInstance , getInstance , getIntegerInstance , getIntegerInstance , getMaximumFractionDigits , getMaximumIntegerDigits , getMinimumFractionDigits , getMinimumIntegerDigits , getNumberInstance , getNumberInstance , getPercentInstance , getPercentInstance , hashCode , isGroupingUsed , isParseIntegerOnly , parse , parse , parseObject , setCurrency , setGroupingUsed , setMaximumFractionDigits , setMaximumIntegerDigits , setMinimumFractionDigits , setMinimumIntegerDigits , setParseIntegerOnly |
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
DecimalFormat
public DecimalFormat()
Constructs a DecimalFormat
which uses the default
pattern and symbols.
DecimalFormat
public DecimalFormat(String pattern)
Constructs a DecimalFormat
which uses the given
pattern and the default symbols for formatting and parsing.
pattern
- the non-localized pattern to use.
DecimalFormat
public DecimalFormat(String pattern,
DecimalFormatSymbols symbols)
Constructs a DecimalFormat
using the given pattern
and formatting symbols. This construction method is used to give
complete control over the formatting process.
pattern
- the non-localized pattern to use.symbols
- the set of symbols used for parsing and formatting.
equals
public boolean equals(Object obj)
Tests this instance for equality with an arbitrary object. This method
returns
true
if:
obj
is not null
;obj
is an instance of DecimalFormat
;- this instance and
obj
have the same attributes;
- equals in interface NumberFormat
obj
- the object (null
permitted).
getCurrency
public Currency getCurrency()
Returns the currency corresponding to the currency symbol stored
in the instance of DecimalFormatSymbols
used by this
DecimalFormat
.
- getCurrency in interface NumberFormat
- A new instance of
Currency
if
the currency code matches a known one, null otherwise.
parse
public Number parse(String str,
ParsePosition pos)
This method parses the specified string into a Number
. This
will be a Long
if possible, otherwise it will be a
Double
. If no number can be parsed, no exception is
thrown. Instead, the parse position remains at its initial index.
- parse in interface NumberFormat
pos
- The desired ParsePosition
.
setDecimalFormatSymbols
public void setDecimalFormatSymbols(DecimalFormatSymbols newSymbols)
Sets the symbols used by this instance. This method makes a copy of
the supplied symbols.
newSymbols
- the symbols (null
not permitted).
setMaximumFractionDigits
public void setMaximumFractionDigits(int newValue)
This method sets the maximum number of digits allowed in the fraction
portion of a number to the specified value. If this is less than the
current minimum allowed digits, the minimum allowed digits value will
be lowered to be equal to the new maximum allowed digits value.
- setMaximumFractionDigits in interface NumberFormat
setMaximumIntegerDigits
public void setMaximumIntegerDigits(int newValue)
This method sets the maximum number of digits allowed in the integer
portion of a number to the specified value. If this is less than the
current minimum allowed digits, the minimum allowed digits value will
be lowered to be equal to the new maximum allowed digits value.
- setMaximumIntegerDigits in interface NumberFormat
setMinimumFractionDigits
public void setMinimumFractionDigits(int newValue)
This method sets the minimum number of digits allowed in the fraction
portion of a number to the specified value. If this is greater than the
current maximum allowed digits, the maximum allowed digits value will
be raised to be equal to the new minimum allowed digits value.
- setMinimumFractionDigits in interface NumberFormat
setMinimumIntegerDigits
public void setMinimumIntegerDigits(int newValue)
This method sets the minimum number of digits allowed in the integer
portion of a number to the specified value. If this is greater than the
current maximum allowed digits, the maximum allowed digits value will
be raised to be equal to the new minimum allowed digits value.
- setMinimumIntegerDigits in interface NumberFormat
DecimalFormat.java -- Formats and parses numbers
Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.