19#if !UCONFIG_NO_FORMATTING
30#if U_SHOW_CPLUSPLUS_API
255#ifndef U_HIDE_DEPRECATED_API
279 UNUM_PAD_BEFORE_PREFIX,
280 UNUM_PAD_AFTER_PREFIX,
281 UNUM_PAD_BEFORE_SUFFIX,
282 UNUM_PAD_AFTER_SUFFIX
311#ifndef U_FORCE_HIDE_DEPRECATED_API
360#ifndef U_HIDE_DEPRECATED_API
431 const UChar* pattern,
432 int32_t patternLength,
447#if U_SHOW_CPLUSPLUS_API
506 int32_t resultLength,
538 int32_t resultLength,
570 int32_t resultLength,
620 int32_t resultLength,
658 int32_t resultLength,
697 int32_t resultLength,
725 int32_t resultLength,
841 int32_t outBufLength,
918 const UChar *pattern,
919 int32_t patternLength,
934U_CAPI const char* U_EXPORT2
949#if UCONFIG_HAVE_PARSEALLINPUT
954typedef enum UNumberFormatAttributeValue {
955#ifndef U_HIDE_INTERNAL_API
964 UNUM_FORMAT_ATTRIBUTE_VALUE_HIDDEN
966} UNumberFormatAttributeValue;
1016#if UCONFIG_HAVE_PARSEALLINPUT
1021 UNUM_PARSE_ALL_INPUT = 20,
1054#ifndef U_HIDE_INTERNAL_API
1101#ifndef U_HIDE_INTERNAL_API
1272 int32_t resultLength,
1294 const UChar* newValue,
1295 int32_t newValueLength,
1316 UBool isPatternLocalized,
1318 int32_t resultLength,
1408#ifndef U_HIDE_INTERNAL_API
1415#ifndef U_HIDE_DEPRECATED_API
1477U_CAPI const char* U_EXPORT2
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
C API: Parse Error Information.
A struct representing a range of text containing a specific field.
A UParseError struct is used to returned detailed information about parsing errors.
C API: Encapsulates information about a currency.
C API: Display context types (enum values)
UDisplayContextType
Display context types, for getting values of a particular setting.
UDisplayContext
Display context settings.
C API: UFieldPositionIterator for use with format APIs.
struct UFieldPositionIterator UFieldPositionIterator
C typedef for struct UFieldPositionIterator.
C API: Locale ID functionality similar to C++ class Locale.
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested,...
int8_t UBool
The ICU boolean type, a signed-byte integer.
#define U_CAPI
This is used to declare a function as a public ICU C API.
char16_t UChar
The base type for UTF-16 code units and pointers.
C API: Miscellaneous definitions.
U_CAPI int32_t unum_format(const UNumberFormat *fmt, int32_t number, UChar *result, int32_t resultLength, UFieldPosition *pos, UErrorCode *status)
Format an integer using a UNumberFormat.
U_CAPI int32_t unum_parseDecimal(const UNumberFormat *fmt, const UChar *text, int32_t textLength, int32_t *parsePos, char *outBuf, int32_t outBufLength, UErrorCode *status)
Parse a number from a string into an unformatted numeric string using a UNumberFormat.
U_CAPI void unum_setContext(UNumberFormat *fmt, UDisplayContext value, UErrorCode *status)
Set a particular UDisplayContext value in the formatter, such as UDISPCTX_CAPITALIZATION_FOR_STANDALO...
U_CAPI int32_t unum_formatDouble(const UNumberFormat *fmt, double number, UChar *result, int32_t resultLength, UFieldPosition *pos, UErrorCode *status)
Format a double using a UNumberFormat.
UNumberFormatAttribute
The possible UNumberFormat numeric attributes.
@ UNUM_GROUPING_SIZE
Grouping size.
@ UNUM_LENIENT_PARSE
Lenient parse mode used by rule-based formats.
@ UNUM_MIN_SIGNIFICANT_DIGITS
Minimum significant digits.
@ UNUM_MAX_INTEGER_DIGITS
Maximum integer digits.
@ UNUM_MAX_FRACTION_DIGITS
Maximum fraction digits.
@ UNUM_PARSE_NO_EXPONENT
if this attribute is set to 1, specifies that, if the pattern doesn't contain an exponent,...
@ UNUM_FORMAT_WIDTH
The width to which the output of format() is padded.
@ UNUM_LIMIT_BOOLEAN_ATTRIBUTE
Limit of boolean attributes.
@ UNUM_PARSE_INT_ONLY
Parse integers only.
@ UNUM_MULTIPLIER
Multiplier.
@ UNUM_ROUNDING_INCREMENT
Rounding increment.
@ UNUM_PARSE_CASE_SENSITIVE
Parsing: if set to 1, parsing is sensitive to case (lowercase/uppercase).
@ UNUM_SIGNIFICANT_DIGITS_USED
Use significant digits.
@ UNUM_MINIMUM_GROUPING_DIGITS
Minimum grouping digits; most commonly set to 2 to print "1000" instead of "1,000".
@ UNUM_SECONDARY_GROUPING_SIZE
Secondary grouping size.
@ UNUM_MIN_FRACTION_DIGITS
Minimum fraction digits.
@ UNUM_DECIMAL_ALWAYS_SHOWN
Always show decimal point.
@ UNUM_MAX_SIGNIFICANT_DIGITS
Maximum significant digits.
@ UNUM_INTEGER_DIGITS
Integer digits.
@ UNUM_FRACTION_DIGITS
Fraction digits.
@ UNUM_PARSE_DECIMAL_MARK_REQUIRED
if this attribute is set to 1, specifies that, if the pattern contains a decimal mark the input is re...
@ UNUM_SIGN_ALWAYS_SHOWN
Formatting: if set to 1, whether to show the plus sign on non-negative numbers.
@ UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS
If 1, specifies that if setting the "max integer digits" attribute would truncate a value,...
@ UNUM_CURRENCY_USAGE
if this attribute is set to 0, it is set to UNUM_CURRENCY_STANDARD purpose, otherwise it is UNUM_CASH...
@ UNUM_ROUNDING_MODE
Rounding Mode.
@ UNUM_SCALE
Scale, which adjusts the position of the decimal point when formatting.
@ UNUM_PADDING_POSITION
The position at which padding will take place.
@ UNUM_MAX_NONBOOLEAN_ATTRIBUTE
One below the first bitfield-boolean item.
@ UNUM_MIN_INTEGER_DIGITS
Minimum integer digits.
@ UNUM_GROUPING_USED
Use grouping separator.
U_CAPI UNumberFormat * unum_clone(const UNumberFormat *fmt, UErrorCode *status)
Open a copy of a UNumberFormat.
U_CAPI void unum_setTextAttribute(UNumberFormat *fmt, UNumberFormatTextAttribute tag, const UChar *newValue, int32_t newValueLength, UErrorCode *status)
Set a text attribute associated with a UNumberFormat.
UCurrencySpacing
Constants for specifying currency spacing.
@ UNUM_CURRENCY_SPACING_COUNT
One more than the highest normal UCurrencySpacing value.
@ UNUM_CURRENCY_SURROUNDING_MATCH
U_CAPI int32_t unum_formatDoubleForFields(const UNumberFormat *format, double number, UChar *result, int32_t resultLength, UFieldPositionIterator *fpositer, UErrorCode *status)
Format a double using a UNumberFormat according to the UNumberFormat's locale, and initialize a UFiel...
U_CAPI int32_t unum_formatInt64(const UNumberFormat *fmt, int64_t number, UChar *result, int32_t resultLength, UFieldPosition *pos, UErrorCode *status)
Format an int64 using a UNumberFormat.
U_CAPI double unum_parseDouble(const UNumberFormat *fmt, const UChar *text, int32_t textLength, int32_t *parsePos, UErrorCode *status)
Parse a string into a double using a UNumberFormat.
U_CAPI int32_t unum_formatDecimal(const UNumberFormat *fmt, const char *number, int32_t length, UChar *result, int32_t resultLength, UFieldPosition *pos, UErrorCode *status)
Format a decimal number using a UNumberFormat.
UNumberCompactStyle
Constants for specifying short or long format.
U_CAPI bool unum_hasAttribute(const UNumberFormat *fmt, UNumberFormatAttribute attr)
Returns true if the formatter supports the specified attribute and false if not.
UNumberFormatStyle
The possible number format styles.
@ UNUM_CURRENCY
Currency format (generic).
@ UNUM_SCIENTIFIC
Scientific format.
@ UNUM_CURRENCY_PLURAL
Currency format with a pluralized currency name, e.g., "1.00 US dollar" and "3.00 US dollars".
@ UNUM_PATTERN_RULEBASED
Rule-based format defined by a pattern string.
@ UNUM_SPELLOUT
Spellout rule-based format.
@ UNUM_DECIMAL_COMPACT_SHORT
Decimal format expressed using compact notation (short form, corresponds to UNumberCompactStyle=UNUM_...
@ UNUM_CASH_CURRENCY
Currency format with a currency symbol given CASH usage, e.g., "NT$3" instead of "NT$3....
@ UNUM_DECIMAL_COMPACT_LONG
Decimal format expressed using compact notation (long form, corresponds to UNumberCompactStyle=UNUM_L...
@ UNUM_FORMAT_STYLE_COUNT
One more than the highest normal UNumberFormatStyle value.
@ UNUM_PERCENT
Percent format.
@ UNUM_ORDINAL
Ordinal rule-based format .
@ UNUM_CURRENCY_ISO
Currency format with an ISO currency code, e.g., "USD1.00".
@ UNUM_NUMBERING_SYSTEM
Numbering system rule-based format.
@ UNUM_CURRENCY_STANDARD
Currency format with a currency symbol, e.g., "$1.00", using non-accounting style for negative values...
@ UNUM_DEFAULT
Default format.
@ UNUM_PATTERN_DECIMAL
Decimal format defined by a pattern string.
@ UNUM_DURATION
Duration rule-based format.
@ UNUM_CURRENCY_ACCOUNTING
Currency format for accounting, e.g., "($3.00)" for negative currency amount instead of "-$3....
@ UNUM_IGNORE
Alias for UNUM_PATTERN_DECIMAL.
@ UNUM_DECIMAL
Decimal format ("normal" style).
U_CAPI int32_t unum_toPattern(const UNumberFormat *fmt, UBool isPatternLocalized, UChar *result, int32_t resultLength, UErrorCode *status)
Extract the pattern from a UNumberFormat.
U_CAPI double unum_getDoubleAttribute(const UNumberFormat *fmt, UNumberFormatAttribute attr)
Get a numeric attribute associated with a UNumberFormat.
U_CAPI UDisplayContext unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode *status)
Get the formatter's UDisplayContext value for the specified UDisplayContextType, such as UDISPCTX_TYP...
U_CAPI int32_t unum_countAvailable(void)
Determine how many locales have decimal formatting patterns available.
U_CAPI int64_t unum_parseInt64(const UNumberFormat *fmt, const UChar *text, int32_t textLength, int32_t *parsePos, UErrorCode *status)
Parse a string into an int64 using a UNumberFormat.
U_CAPI UNumberFormat * unum_open(UNumberFormatStyle style, const UChar *pattern, int32_t patternLength, const char *locale, UParseError *parseErr, UErrorCode *status)
Create and return a new UNumberFormat for formatting and parsing numbers.
UNumberFormatSymbol
Constants for specifying a number format symbol.
@ UNUM_FOUR_DIGIT_SYMBOL
Four.
@ UNUM_PERMILL_SYMBOL
Per mill symbol.
@ UNUM_SIGNIFICANT_DIGIT_SYMBOL
Significant digit symbol.
@ UNUM_PAD_ESCAPE_SYMBOL
Escape padding character.
@ UNUM_INFINITY_SYMBOL
Infinity symbol.
@ UNUM_TWO_DIGIT_SYMBOL
Two.
@ UNUM_EXPONENTIAL_SYMBOL
The exponential symbol.
@ UNUM_CURRENCY_SYMBOL
The currency symbol.
@ UNUM_INTL_CURRENCY_SYMBOL
The international currency symbol.
@ UNUM_FIVE_DIGIT_SYMBOL
Five.
@ UNUM_EXPONENT_MULTIPLICATION_SYMBOL
Multiplication sign.
@ UNUM_EIGHT_DIGIT_SYMBOL
Eight.
@ UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL
The monetary grouping separator.
@ UNUM_PERCENT_SYMBOL
The percent sign.
@ UNUM_PATTERN_SEPARATOR_SYMBOL
The pattern separator.
@ UNUM_DECIMAL_SEPARATOR_SYMBOL
The decimal separator.
@ UNUM_PLUS_SIGN_SYMBOL
The plus sign.
@ UNUM_GROUPING_SEPARATOR_SYMBOL
The grouping separator.
@ UNUM_NAN_SYMBOL
Nan symbol.
@ UNUM_SIX_DIGIT_SYMBOL
Six.
@ UNUM_NINE_DIGIT_SYMBOL
Nine.
@ UNUM_APPROXIMATELY_SIGN_SYMBOL
Approximately sign.
@ UNUM_MINUS_SIGN_SYMBOL
The minus sign.
@ UNUM_MONETARY_SEPARATOR_SYMBOL
The monetary separator.
@ UNUM_DIGIT_SYMBOL
Character representing a digit in the pattern.
@ UNUM_THREE_DIGIT_SYMBOL
Three.
@ UNUM_ZERO_DIGIT_SYMBOL
Zero.
@ UNUM_ONE_DIGIT_SYMBOL
One.
@ UNUM_FORMAT_SYMBOL_COUNT
One more than the highest normal UNumberFormatSymbol value.
@ UNUM_SEVEN_DIGIT_SYMBOL
Seven.
U_CAPI double unum_parseDoubleCurrency(const UNumberFormat *fmt, const UChar *text, int32_t textLength, int32_t *parsePos, UChar *currency, UErrorCode *status)
Parse a string into a double and a currency using a UNumberFormat.
UNumberFormatMinimumGroupingDigits
Selectors with special numeric values to use locale default minimum grouping digits for the DecimalFo...
@ UNUM_MINIMUM_GROUPING_DIGITS_MIN2
Display grouping using locale defaults, except do not show grouping on values smaller than 10000 (suc...
@ UNUM_MINIMUM_GROUPING_DIGITS_AUTO
Display grouping using the default strategy for all locales.
U_CAPI int32_t unum_formatDoubleCurrency(const UNumberFormat *fmt, double number, UChar *currency, UChar *result, int32_t resultLength, UFieldPosition *pos, UErrorCode *status)
Format a double currency amount using a UNumberFormat.
U_CAPI const char * unum_getAvailable(int32_t localeIndex)
Get a locale for which decimal formatting patterns are available.
U_CAPI int32_t unum_getTextAttribute(const UNumberFormat *fmt, UNumberFormatTextAttribute tag, UChar *result, int32_t resultLength, UErrorCode *status)
Get a text attribute associated with a UNumberFormat.
U_CAPI UFormattable * unum_parseToUFormattable(const UNumberFormat *fmt, UFormattable *result, const UChar *text, int32_t textLength, int32_t *parsePos, UErrorCode *status)
Parse a UChar string into a UFormattable.
U_CAPI int32_t unum_getAttribute(const UNumberFormat *fmt, UNumberFormatAttribute attr)
Get a numeric attribute associated with a UNumberFormat.
U_CAPI int32_t unum_parse(const UNumberFormat *fmt, const UChar *text, int32_t textLength, int32_t *parsePos, UErrorCode *status)
Parse a string into an integer using a UNumberFormat.
UNumberFormatTextAttribute
The possible UNumberFormat text attributes.
@ UNUM_NEGATIVE_PREFIX
Negative prefix.
@ UNUM_POSITIVE_PREFIX
Positive prefix.
@ UNUM_DEFAULT_RULESET
The default rule set, such as "%spellout-numbering-year:", "%spellout-cardinal:", "%spellout-ordinal-...
@ UNUM_PUBLIC_RULESETS
The public rule sets.
@ UNUM_PADDING_CHARACTER
The character used to pad to the format width.
@ UNUM_CURRENCY_CODE
The ISO currency code.
@ UNUM_NEGATIVE_SUFFIX
Negative suffix.
@ UNUM_POSITIVE_SUFFIX
Positive suffix.
U_CAPI int32_t unum_getSymbol(const UNumberFormat *fmt, UNumberFormatSymbol symbol, UChar *buffer, int32_t size, UErrorCode *status)
Get a symbol associated with a UNumberFormat.
U_CAPI void unum_setDoubleAttribute(UNumberFormat *fmt, UNumberFormatAttribute attr, double newValue)
Set a numeric attribute associated with a UNumberFormat.
void * UNumberFormat
A number formatter.
U_CAPI void unum_setAttribute(UNumberFormat *fmt, UNumberFormatAttribute attr, int32_t newValue)
Set a numeric attribute associated with a UNumberFormat.
UNumberFormatPadPosition
The possible number format pad positions.
U_CAPI void unum_close(UNumberFormat *fmt)
Close a UNumberFormat.
UNumberFormatFields
FieldPosition and UFieldPosition selectors for format fields defined by NumberFormat and UNumberForma...
@ UNUM_MEASURE_UNIT_FIELD
@ UNUM_EXPONENT_SYMBOL_FIELD
@ UNUM_GROUPING_SEPARATOR_FIELD
@ UNUM_DECIMAL_SEPARATOR_FIELD
@ UNUM_APPROXIMATELY_SIGN_FIELD
Approximately sign.
@ UNUM_FIELD_COUNT
One more than the highest normal UNumberFormatFields value.
@ UNUM_EXPONENT_SIGN_FIELD
U_CAPI void unum_setSymbol(UNumberFormat *fmt, UNumberFormatSymbol symbol, const UChar *value, int32_t length, UErrorCode *status)
Set a symbol associated with a UNumberFormat.
U_CAPI void unum_applyPattern(UNumberFormat *format, UBool localized, const UChar *pattern, int32_t patternLength, UParseError *parseError, UErrorCode *status)
Set the pattern used by a UNumberFormat.
U_CAPI int32_t unum_formatUFormattable(const UNumberFormat *fmt, const UFormattable *number, UChar *result, int32_t resultLength, UFieldPosition *pos, UErrorCode *status)
Format a UFormattable into a string.
U_CAPI const char * unum_getLocaleByType(const UNumberFormat *fmt, ULocDataLocaleType type, UErrorCode *status)
Get the locale for this number format object.
C API: Header-only input options for various number formatting APIs.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.