ScientificNotation
open class ScientificNotation : Notation
kotlin.Any | ||
↳ | android.icu.number.Notation | |
↳ | android.icu.number.ScientificNotation |
A class that defines the scientific notation style to be used when formatting numbers in NumberFormatter.
To create a ScientificNotation, use one of the factory methods in Notation
.
Summary
Public methods | |
---|---|
open ScientificNotation! |
withExponentSignDisplay(exponentSignDisplay: NumberFormatter.SignDisplay!) Sets whether to show the sign on positive and negative exponents in scientific notation. |
open ScientificNotation! |
withMinExponentDigits(minExponentDigits: Int) Sets the minimum number of digits to show in the exponent of scientific notation, padding with zeros if necessary. |
Inherited functions | |
---|---|
Public methods
withExponentSignDisplay
open fun withExponentSignDisplay(exponentSignDisplay: NumberFormatter.SignDisplay!): ScientificNotation!
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 |
NumberFormatter.SignDisplay!: The strategy for displaying the sign in the exponent. |
Return | |
---|---|
ScientificNotation! |
A ScientificNotation, for chaining. |
See Also
withMinExponentDigits
open fun withMinExponentDigits(minExponentDigits: Int): ScientificNotation!
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 |
Int: The minimum number of digits to show in the exponent. |
Return | |
---|---|
ScientificNotation! |
A ScientificNotation, for chaining. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if minExponentDigits is too big or smaller than 1 |
See Also