A formatter that formats numbers in user-friendly scientific notation.
More...
#include <scientificnumberformatter.h>
A formatter that formats numbers in user-friendly scientific notation.
Sample code:
UErrorCode status = U_ZERO_ERROR;
LocalPointer<ScientificNumberFormatter> fmt(
ScientificNumberFormatter::createMarkupInstance(
"en", "<sup>", "</sup>", status));
if (U_FAILURE(status)) {
return;
}
UnicodeString appendTo;
// appendTo = "1.23456x10<sup>-78</sup>"
fmt->format(1.23456e-78, appendTo, status);
- Stable
- ICU 55
Definition at line 52 of file scientificnumberformatter.h.
◆ ~ScientificNumberFormatter()
| virtual icu::ScientificNumberFormatter::~ScientificNumberFormatter |
( |
| ) |
|
|
virtual |
◆ clone()
| ScientificNumberFormatter * icu::ScientificNumberFormatter::clone |
( |
| ) |
const |
|
inline |
◆ createMarkupInstance() [1/2]
Creates a ScientificNumberFormatter instance that uses markup for exponents for this locale.
- Parameters
-
| locale | The locale |
| beginMarkup | the markup to start superscript. |
| endMarkup | the markup to end superscript. |
| status | error returned here. |
- Returns
- The ScientificNumberFormatter instance.
- Stable
- ICU 55
◆ createMarkupInstance() [2/2]
◆ createSuperscriptInstance() [1/2]
| ScientificNumberFormatter * icu::ScientificNumberFormatter::createSuperscriptInstance |
( |
const Locale & | locale, |
|
|
UErrorCode & | status ) |
|
static |
◆ createSuperscriptInstance() [2/2]
| ScientificNumberFormatter * icu::ScientificNumberFormatter::createSuperscriptInstance |
( |
DecimalFormat * | fmtToAdopt, |
|
|
UErrorCode & | status ) |
|
static |
◆ format()
Formats a number into user friendly scientific notation.
- Parameters
-
| number | the number to format. |
| appendTo | formatted string appended here. |
| status | any error returned here. |
- Returns
- appendTo
- Stable
- ICU 55
References clone(), format(), and U_I18N_API.
Referenced by format().
The documentation for this class was generated from the following file: