public class OAConverterNumber extends Object implements OAConverterInterface
Format String Symbol Meaning (same as DecimalFormat)
0 a digit, if no digit exists, then '0' will be used. ex: '000' for 38 = '038' # a digit, zero shows as absent ex: '#' for 8204 = '8204' . placeholder for decimal separator , placeholder for grouping separator. ; separates formats. - default negative prefix. % multiply by 100 and show as percentage (‰) � multiply by 1000 and show as per mille (¤) � currency sign; replaced by currency symbol; if doubled, replaced by international currency symbol. If present in a pattern, the monetary decimal separator is used instead of the decimal separator. X any other characters can be used in the prefix or suffix ' used to quote special characters in a prefix or suffix. Examples: IntegerFormat = #,### DecimalFormat = #,##0.00 MoneyFormat = ¤#,##0.00 BooleanFormat = true;false;null ALSO** support for OAString.format
NOTE: this also does rounding when digits are truncated.
OAConverter
,
OAString.format(double, String)
Constructor and Description |
---|
OAConverterNumber() |
Modifier and Type | Method and Description |
---|---|
Object |
convert(Class clazz,
Object value,
String fmt)
Convert to/from a Number value.
|
protected Object |
convertFromNumber(Class toClass,
Number numValue,
String fmt) |
protected Number |
convertToNumber(Class clazz,
Object value,
String fmt)
Returns Number subclass to match clazz parameter, 0 if value is null, or null if it can not be parsed.
|
protected com.viaoa.util.converter.OAConverterNumber.FormatPool |
getFormatter(String fmt) |
static void |
main(String[] args) |
protected Vector vec
public Object convert(Class clazz, Object value, String fmt)
convert
in interface OAConverterInterface
protected Number convertToNumber(Class clazz, Object value, String fmt)
protected com.viaoa.util.converter.OAConverterNumber.FormatPool getFormatter(String fmt)
public static void main(String[] args)
Copyright © 1999–2019 ViaOA. All rights reserved.