public class NumericFormat extends java.lang.Object implements IFormat
NumericalFormat is a utility class to format numeric value. You can specify the no. of decimal point, currency symbol, thousand separator etc.
LocaleNumericFormat
Modifier and Type | Field and Description |
---|---|
int |
currencyPos
currency position, 0 - before number (default), 1 - after negative sign, 2 - after number, 3
- after number and negative sign.
|
char |
currencySymbol
currency symbol, default none
|
int |
decimal
decimal point, range from 1 to 6, default 2
|
char |
decimalSep
decimal point char, default '.'
|
boolean |
leadingZero
leading zero, 0 or 1
|
int |
negative
negative position, 0 - before currency sign (default), 1 - after currency sign, 2 - end of
number
|
boolean |
oneSymPerPage
Deprecated.
not used.
|
int |
rounding
no.
|
boolean |
sciExp
either 0 or 1, invalid when not currency, default 0
|
char |
thousandSep
thousand separator, if 'N' means no thousand separator.
|
DATETIME, LOCALEDATETIME, LOCALENUMERIC, LOGICAL, NUMERIC
Constructor and Description |
---|
NumericFormat()
Create a new numeric format with default values.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
format(java.lang.Object obj)
Define quadbase.util.IFormat.
|
int |
getFormatType()
Define quadbase.util.IFormat.
|
java.lang.String |
output(double d)
Output the formatted number.
|
void |
setDefault()
Set all variables to default value.
|
void |
setFormat(char currSymInit,
boolean oneSymPerPageInit,
int currencyPosInit,
int decimalInit,
int roundingInit,
int negativeInit,
char decimalSepInit,
char thousandSepInit,
boolean leadingZeroInit)
Set Numeric format.
|
void |
setScientifExp(int precision)
Set scientific expression.
|
java.lang.String |
toString() |
public boolean sciExp
public char currencySymbol
@Deprecated public boolean oneSymPerPage
public int currencyPos
public int decimal
public int rounding
public int negative
public char decimalSep
public char thousandSep
public boolean leadingZero
public NumericFormat()
public int getFormatType()
getFormatType
in interface IFormat
public java.lang.String format(java.lang.Object obj)
public void setDefault()
public void setScientifExp(int precision)
precision
- no of decimal pointpublic void setFormat(char currSymInit, boolean oneSymPerPageInit, int currencyPosInit, int decimalInit, int roundingInit, int negativeInit, char decimalSepInit, char thousandSepInit, boolean leadingZeroInit)
currSymInit
- currency symboloneSymPerPageInit
- not used, always set to falsecurrencyPosInit
- currency position 0-2decimalInit
- no. of decimal pointroundingInit
- no. of significant digitnegativeInit
- negative symbol position 0-2decimalSepInit
- decimal point symbolthoudsandSepInit
- thousands separator symbol, 'N' means no thousands separatorleadingZeroInit
- leading zeropublic java.lang.String output(double d)
d
- number to be formattedpublic java.lang.String toString()
toString
in class java.lang.Object