XBinder C# Runtime Library
2.7
|
XBDoubleFormat is used for formatting double/float values into decimal strings. More...
Public Member Functions | |
XBDoubleFormat () | |
XBDoubleFormat constructor applying default options. More... | |
XBDoubleFormat (int totalDigits, int fractionDigits, int fractionMinDigits, int integerMaxDigits, int integerMinDigits, char expSymbol, int expMinValue, int expMaxValue, int expDigits, bool signPresent, bool pointPresent, bool expPresent, bool expSignPresent) | |
XBDoubleFormat constructor. More... | |
virtual System.String | format (double value_Renamed) |
Returns a valid XML Schema lexical representation of the given double value. This differs from the standard Java Double.toString() in the following ways: More... | |
virtual System.String | format (float value_Renamed) |
Returns a valid XML Schema lexical representation of the given float value. This differs from the standard Java Float.toString() in the following ways: More... | |
XBDoubleFormat is used for formatting double/float values into decimal strings.
Depending on the constructor arguments, an XBDoubleFormat may format strings using exponential notation, decimal notation, or a mixture of these. These options are explained below.
totalDigits: The maximum total number of digits to be displayed. Pass -1 to let this be defaulted based on the datatype being formatted.
fractionDigits: The maximum number of fraction digits to be displayed. Trailing zeros do not count. Pass -1 for unspecified.
fractionMinDigits: The minimum number of fraction digits to be displayed. Trailing zeros are added if necessary. Values less than 0 are ignored.
integerMaxDigits: The maximum number of integer digits to be displayed. Pass -1 for unspecified.
integerMinDigits: The minimum number of integer digits to be displayed. Leading zeros are added if necessary. Values less than 0 are ignored.
expDigits: The minimum number of digits to use for the exponent. 0 means use decimal notation. >=1 means use exponential notation. -1 means "unspecified".
expSymbol: If decimal notation is chosen (expDigits = 0), large values are handled in one of two ways: if expSymbol = '0': trailing zeros in the integer part are allowed otherwise: revert to exponential notation with minimal exponent value
expMinValue: minimum exponent value; less than or equal to Short.MIN_VALUE means "unspecified"
expMaxValue: maximum exponent value; >= Short.MAX_VALUE means "unspecified"
If exponential notation is chosen (using expDigits, expMinValue, or expMaxValue), the exponent is decided using one of two methods: 1) based on the defined range (if expMinValue or expMaxValue are used) 2) based on the digits constraints (totalDigits, integerMaxDigits, and fractionDigits).
Exponential notation "by range": The exponent is normalized, if possible, subject to the given range.
Exponential notation "by digit constraints": The exponent is chosen so as to:
Decimal notation: standard decimal notation, but see expSymbol, which controls the behavior when totalDigits or integerMaxDigits are insufficient for a decimal representation.
Mixed Notation: if neither exponential nor decimal notation is chosen (ie, expMinValue, expMaxValue, and expDigits are "unspecified"), then mixed notation is used (thus, this is the default). If 1 less than or equal to |value| less than 10^10 decimal notation is used, otherwise exponential notation is used. If totalDigits or integerMaxDigits are insufficient, trailing integer zeros are used.
Thread safety: instances of this class are thread-safe and may be shared by threads.
<author> Kevin
</author>
com.objsys.xbinder.runtime.XBDoubleFormat.XBDoubleFormat | ( | ) |
XBDoubleFormat constructor applying default options.
com.objsys.xbinder.runtime.XBDoubleFormat.XBDoubleFormat | ( | int | totalDigits, |
int | fractionDigits, | ||
int | fractionMinDigits, | ||
int | integerMaxDigits, | ||
int | integerMinDigits, | ||
char | expSymbol, | ||
int | expMinValue, | ||
int | expMaxValue, | ||
int | expDigits, | ||
bool | signPresent, | ||
bool | pointPresent, | ||
bool | expPresent, | ||
bool | expSignPresent | ||
) |
XBDoubleFormat constructor.
|
virtual |
Returns a valid XML Schema lexical representation of the given double value. This differs from the standard Java Double.toString() in the following ways:
value |
|
virtual |
Returns a valid XML Schema lexical representation of the given float value. This differs from the standard Java Float.toString() in the following ways:
value |