public final class CompositeFormat extends Object
Modifier and Type | Method and Description |
---|---|
static StringBuffer |
formatDouble(double value,
NumberFormat format,
StringBuffer toAppendTo,
FieldPosition pos)
Formats a double value to produce a string.
|
static NumberFormat |
getDefaultNumberFormat()
Create a default number format.
|
static NumberFormat |
getDefaultNumberFormat(Locale locale)
Create a default number format.
|
static NumberFormat |
getDefaultNumberFormat(Locale locale,
int maximumFractionDigits)
Create a default number format.
|
static void |
parseAndIgnoreWhitespace(String source,
ParsePosition pos)
Parses
source until a non-whitespace character is found. |
static boolean |
parseFixedstring(String source,
String expected,
ParsePosition pos)
Parse
source for an expected fixed string. |
static char |
parseNextCharacter(String source,
ParsePosition pos)
Parses
source until a non-whitespace character is found. |
static Number |
parseNumber(String source,
NumberFormat format,
ParsePosition pos)
Parses
source for a number. |
public static NumberFormat getDefaultNumberFormat()
NumberFormat.getInstance()
with the
only customizing that the
maximum number of fraction digits is set to 10.public static NumberFormat getDefaultNumberFormat(Locale locale)
NumberFormat.getInstance(Locale)
with the only customizing that the maximum number of fraction digits is set to 10.locale
- the specific locale used by the formatpublic static NumberFormat getDefaultNumberFormat(Locale locale, int maximumFractionDigits)
NumberFormat.getInstance(Locale)
.locale
- the specific locale used by the formatmaximumFractionDigits
- the maximum number of fraction digits to be shown;
if less than zero, then zero is used.public static void parseAndIgnoreWhitespace(String source, ParsePosition pos)
source
until a non-whitespace character is found.source
- the string to parsepos
- input/output parsing parameter. On output, pos
holds the index of the next non-whitespace
character.public static char parseNextCharacter(String source, ParsePosition pos)
source
until a non-whitespace character is found.source
- the string to parsepos
- input/output parsing parameterpublic static Number parseNumber(String source, NumberFormat format, ParsePosition pos)
source
for a number. This method can parse normal,
numeric values as well as special values. These special values include Double.NaN
,
Double.POSITIVE_INFINITY
, Double.NEGATIVE_INFINITY
.source
- the string to parseformat
- the number format used to parse normal, numeric valuespos
- input/output parsing parameterpublic static boolean parseFixedstring(String source, String expected, ParsePosition pos)
source
for an expected fixed string.source
- the string to parseexpected
- expected stringpos
- input/output parsing parameterpublic static StringBuffer formatDouble(double value, NumberFormat format, StringBuffer toAppendTo, FieldPosition pos)
format
.value
- the double to formatformat
- the format usedtoAppendTo
- where the text is to be appendedpos
- On input: an alignment field, if desired. On output: the
offsets of the alignment fieldCopyright © 2023 CNES. All rights reserved.