Class ScientificNotation
java.lang.Object
com.ibm.icu.number.Notation
com.ibm.icu.number.ScientificNotation
-
Method Summary
Modifier and TypeMethodDescriptionwithExponentSignDisplay(NumberFormatter.SignDisplay exponentSignDisplay) Sets whether to show the sign on positive and negative exponents in scientific notation.withMinExponentDigits(int minExponentDigits) Sets the minimum number of digits to show in the exponent of scientific notation, padding with zeros if necessary.Methods inherited from class Notation
compactLong, compactShort, engineering, scientific, simpleModifier and TypeMethodDescriptionstatic CompactNotationPrint the number using long-form compact notation.static CompactNotationPrint the number using short-form compact notation.static ScientificNotationPrint the number using engineering notation, a variant of scientific notation in which the exponent must be divisible by 3.static ScientificNotationPrint the number using scientific notation (also known as scientific form, standard index form, or standard form in the UK).static SimpleNotationsimple()Print the number using simple notation without any scaling by powers of ten.
-
Method Details
-
withMinExponentDigits
Sets the minimum number of digits to show in the exponent of scientific notation, padding with zeros if necessary. Useful for fixed-width display.For example, with minExponentDigits=2, the number 123 will be printed as "1.23E02" in en-US instead of the default "1.23E2".
- Parameters:
minExponentDigits- The minimum number of digits to show in the exponent.- Returns:
- A ScientificNotation, for chaining.
- Throws:
IllegalArgumentException- if minExponentDigits is too big or smaller than 1- See Also:
- Status:
- Stable ICU 60.
-
withExponentSignDisplay
Sets whether to show the sign on positive and negative exponents in scientific notation. The default is AUTO, showing the minus sign but not the plus sign.For example, with exponentSignDisplay=ALWAYS, the number 123 will be printed as "1.23E+2" in en-US instead of the default "1.23E2".
- Parameters:
exponentSignDisplay- The strategy for displaying the sign in the exponent.- Returns:
- A ScientificNotation, for chaining.
- See Also:
- Status:
- Stable ICU 60.
-