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 .
|
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.
|
BARCODE, DATETIME, IMAGEURL, LOCALEDATETIME, LOCALENUMERIC, LOGICAL, NUMERIC, STRING, TEXTURL
Constructor and Description |
---|
NumericFormat()
Create a new numeric format with default values
|
Modifier and Type | Method and Description |
---|---|
static NumericFormat |
createFormat(java.lang.String text)
For internal use only
|
java.lang.String |
format(java.lang.Object obj)
Define quadbase.reportdesigner.util.IFormat Use the doubleValue() method in java.lang.Number
to return a formatted string If the target object is not an instance of Number, use the
default toString() method
|
int |
getFormatType()
Define quadbase.reportdesigner.util.IFormat Return the type of
quadbase.reportdesigner.util.IFormat
|
java.lang.String |
getTextFormat()
For internal use only
|
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()
For internal use only
|
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
public java.lang.String getTextFormat()
getTextFormat
in interface IFormat
public static NumericFormat createFormat(java.lang.String text) throws java.lang.Exception
java.lang.Exception