public class GeneralFormat
extends java.text.NumberFormat
Modified by: Joseph A. Huwaldt
Format
,
NumberFormat
,
ExponentialFormat
,
Serialized FormConstructor and Description |
---|
GeneralFormat()
Construct an exponential format using default settings.
|
GeneralFormat(java.text.DecimalFormat format)
Create an GeneralFormat based on the given format and
the default locale.
|
GeneralFormat(ExponentialFormat format)
Create an GeneralFormat based on the given format and
the default locale.
|
GeneralFormat(java.util.Locale locale)
Construct an exponential format using the specified Locale.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Create a deep copy of this number format object.
|
boolean |
equals(java.lang.Object obj)
Overrides equals
|
java.lang.StringBuffer |
format(double number,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Format a double to produce a string.
|
java.lang.StringBuffer |
format(long number,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Format a long to produce a string.
|
int |
hashCode()
Overrides hashCode
|
static void |
main(java.lang.String[] args)
A simple static method to test this class.
|
java.lang.Number |
parse(java.lang.String text,
java.text.ParsePosition parsePosition)
Returns an instance of Number with a value matching the given string.
|
format, format, format, getAvailableLocales, getCurrency, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getMaximumFractionDigits, getMaximumIntegerDigits, getMinimumFractionDigits, getMinimumIntegerDigits, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, getRoundingMode, isGroupingUsed, isParseIntegerOnly, parse, parseObject, setCurrency, setGroupingUsed, setMaximumFractionDigits, setMaximumIntegerDigits, setMinimumFractionDigits, setMinimumIntegerDigits, setParseIntegerOnly, setRoundingMode
public GeneralFormat()
public GeneralFormat(java.util.Locale locale)
public GeneralFormat(ExponentialFormat format)
format
- The exponential format that will parse strings.public GeneralFormat(java.text.DecimalFormat format)
format
- The decimal format that will parse parts of the exponential.public java.lang.StringBuffer format(double number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
format
in class java.text.NumberFormat
number
- The double to format.toAppendTo
- Where the text is to be appended.pos
- On input: an alignment field, if desired.
On output: the offsets of the alignment fieldpublic java.lang.StringBuffer format(long number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
format
in class java.text.NumberFormat
number
- The long to format.toAppendTo
- Where the text is to be appended.pos
- On input: an alignment field, if desired.
On output: the offsets of the alignment fieldpublic java.lang.Number parse(java.lang.String text, java.text.ParsePosition parsePosition)
parse
in class java.text.NumberFormat
text
- The String to be parsed. Performance can be greatly enhanced
if all "+" signs are removed from the text before parsing.parsePosition
- On entry, where to begin parsing; on exit,
just past the last parsed character. If parsing fails, the
index will not move and the error index will be set.public java.lang.Object clone()
clone
in class java.text.NumberFormat
public boolean equals(java.lang.Object obj)
equals
in class java.text.NumberFormat
public int hashCode()
hashCode
in class java.text.NumberFormat
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception