public final class ScientificNumberFormatter extends Object
ULocale en = new ULocale("en"); ScientificNumberFormatter fmt = ScientificNumberFormatter.getMarkupInstance( en, "<sup>", "</sup>");
// Output: "1.23456×10<sup>-78</sup>" System.out.println(fmt.format(1.23456e-78));
Modifier and Type | Method and Description |
---|---|
String |
format(Object number)
Formats a number
|
static ScientificNumberFormatter |
getMarkupInstance(DecimalFormat df,
String beginMarkup,
String endMarkup)
Gets a ScientificNumberFormatter instance that uses
markup for exponents.
|
static ScientificNumberFormatter |
getMarkupInstance(ULocale locale,
String beginMarkup,
String endMarkup)
Gets a ScientificNumberFormatter instance that uses
markup for exponents for this locale.
|
static ScientificNumberFormatter |
getSuperscriptInstance(DecimalFormat df)
Gets a ScientificNumberFormatter instance that uses
superscript characters for exponents.
|
static ScientificNumberFormatter |
getSuperscriptInstance(ULocale locale)
Gets a ScientificNumberFormatter instance that uses
superscript characters for exponents for this locale.
|
public static ScientificNumberFormatter getSuperscriptInstance(ULocale locale)
locale
- The localepublic static ScientificNumberFormatter getSuperscriptInstance(DecimalFormat df)
df
- The DecimalFormat must be configured for scientific
notation. Caller may safely change df after this call as this method
clones it when creating the ScientificNumberFormatter.public static ScientificNumberFormatter getMarkupInstance(ULocale locale, String beginMarkup, String endMarkup)
locale
- The localebeginMarkup
- the markup to start superscript e.g <sup>
endMarkup
- the markup to end superscript e.g </sup>
public static ScientificNumberFormatter getMarkupInstance(DecimalFormat df, String beginMarkup, String endMarkup)
df
- The DecimalFormat must be configured for scientific
notation. Caller may safely change df after this call as this method
clones it when creating the ScientificNumberFormatter.beginMarkup
- the markup to start superscript e.g <sup>
endMarkup
- the markup to end superscript e.g </sup>
Copyright © 2016 Unicode, Inc. and others.