public class FlexibleDecimalFormat
extends java.text.DecimalFormat
FlexibleDecimalFormat
is a concrete subclass of
DecimalFormat
that formats decimal numbers in a more flexible way. It has a variety of
features designed to make it possible to parse and format numbers in any
locale, including support for Western, Arabic, and Indic digits.Constructor and Description |
---|
FlexibleDecimalFormat()
Default constructor.
|
FlexibleDecimalFormat(double d)
Constructor.
|
FlexibleDecimalFormat(int digits)
Constructor.
|
FlexibleDecimalFormat(int digits,
boolean trailing)
Constructor.
|
FlexibleDecimalFormat(int digits,
boolean exp,
boolean trailing,
boolean grouping)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.StringBuffer |
format(double number,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos) |
java.lang.StringBuffer |
formatString(java.lang.String str)
Formats a double to produce a string.
|
void |
grouping(boolean grouping)
Sets the grouping flag with the value given.
|
boolean |
needExponentialFormat(double d)
Checks if the given number needs a
ExponentialFormat . |
void |
update(double d)
Updates the format of the FlexibleDecimalFormat by parsering a number given.
|
int |
width()
Returns the width of the flexible decimal numbers format.
|
applyLocalizedPattern, applyPattern, clone, equals, format, format, formatToCharacterIterator, getCurrency, getDecimalFormatSymbols, getGroupingSize, getMaximumFractionDigits, getMaximumIntegerDigits, getMinimumFractionDigits, getMinimumIntegerDigits, getMultiplier, getNegativePrefix, getNegativeSuffix, getPositivePrefix, getPositiveSuffix, getRoundingMode, hashCode, isDecimalSeparatorAlwaysShown, isParseBigDecimal, parse, setCurrency, setDecimalFormatSymbols, setDecimalSeparatorAlwaysShown, setGroupingSize, setGroupingUsed, setMaximumFractionDigits, setMaximumIntegerDigits, setMinimumFractionDigits, setMinimumIntegerDigits, setMultiplier, setNegativePrefix, setNegativeSuffix, setParseBigDecimal, setPositivePrefix, setPositiveSuffix, setRoundingMode, toLocalizedPattern, toPattern
format, format, getAvailableLocales, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, isGroupingUsed, isParseIntegerOnly, parse, parseObject, setParseIntegerOnly
public FlexibleDecimalFormat()
public FlexibleDecimalFormat(int digits)
digits
- number of digits givenpublic FlexibleDecimalFormat(int digits, boolean trailing)
digits
- number of digits giventrailing
- trailing flag given.public FlexibleDecimalFormat(int digits, boolean exp, boolean trailing, boolean grouping)
digits
- given base size.exp
- given exponent size.grouping
- given grouping flag.trailing
- given trailing flag.public FlexibleDecimalFormat(double d)
d
- number given.public void update(double d)
d
- given number.public boolean needExponentialFormat(double d)
ExponentialFormat
.d
- given number.ExponentialFormat
, false otherwise.public void grouping(boolean grouping)
grouping
- grouping flag value to be set.public java.lang.StringBuffer format(double number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
format
in class java.text.DecimalFormat
public int width()
public java.lang.StringBuffer formatString(java.lang.String str)
str
- string given.