C++ API: Library for localized formatting of number, currency, and unit ranges.More...
#include "unicode/utypes.h"#include <atomic>#include "unicode/appendable.h"#include "unicode/fieldpos.h"#include "unicode/formattedvalue.h"#include "unicode/fpositer.h"#include "unicode/numberformatter.h"#include "unicode/unumberrangeformatter.h"Go to the source code of this file.
Data Structures | |
| struct | icu::number::impl::RangeMacroProps |
| class | icu::number::NumberRangeFormatterSettings< Derived > |
| An abstract base class for specifying settings related to number formatting.More... | |
| class | icu::number::UnlocalizedNumberRangeFormatter |
| ANumberRangeFormatter that does not yet have a locale.More... | |
| class | icu::number::LocalizedNumberRangeFormatter |
| ANumberRangeFormatter that has a locale associated with it; this means .formatRange() methods are available.More... | |
| class | icu::number::FormattedNumberRange |
| The result of a number range formatting operation.More... | |
| class | icu::number::NumberRangeFormatter |
| See the main description innumberrangeformatter.h for documentation and examples.More... | |
Namespaces | |
| icu | |
| Filecoll.h. | |
C++ API: Library for localized formatting of number, currency, and unit ranges.
The main entrypoint to the formatting of ranges of numbers, including currencies and other units of measurement.
Usage example:
NumberRangeFormatter::with() .identityFallback(UNUM_IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE) .numberFormatterFirst(NumberFormatter::with().adoptUnit(MeasureUnit::createMeter())) .numberFormatterSecond(NumberFormatter::with().adoptUnit(MeasureUnit::createKilometer())) .locale("en-GB") .formatFormattableRange(750, 1.2, status) .toString(status);// => "750 m - 1.2 km"<p<blockquote>
Like NumberFormatter, NumberRangeFormatter instances (i.e., LocalizedNumberRangeFormatter and UnlocalizedNumberRangeFormatter) are immutable and thread-safe. This API is based on thefluent design pattern popularized by libraries such as Google's Guava.
Definition in filenumberrangeformatter.h.