ICU 69.1 69.1
unum.h
Go to the documentation of this file.
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
3/*
4*******************************************************************************
5* Copyright (C) 1997-2015, International Business Machines Corporation and others.
6* All Rights Reserved.
7* Modification History:
8*
9* Date Name Description
10* 06/24/99 helena Integrated Alan's NF enhancements and Java2 bug fixes
11*******************************************************************************
12*/
13
14#ifndef _UNUM
15#define _UNUM
16
17#include "unicode/utypes.h"
18
19#if !UCONFIG_NO_FORMATTING
20
21#include "unicode/uloc.h"
22#include "unicode/ucurr.h"
23#include "unicode/umisc.h"
24#include "unicode/parseerr.h"
28
29#if U_SHOW_CPLUSPLUS_API
31#endif // U_SHOW_CPLUSPLUS_API
32
144typedef void* UNumberFormat;
145
273
283 UNUM_ROUND_CEILING,
284 UNUM_ROUND_FLOOR,
285 UNUM_ROUND_DOWN,
286 UNUM_ROUND_UP,
292#ifndef U_HIDE_DEPRECATED_API
298#endif /* U_HIDE_DEPRECATED_API */
299 UNUM_ROUND_HALFDOWN = UNUM_ROUND_HALFEVEN + 1,
300 UNUM_ROUND_HALFUP,
306#ifndef U_HIDE_DRAFT_API
322#endif // U_HIDE_DRAFT_API
324
329 UNUM_PAD_BEFORE_PREFIX,
330 UNUM_PAD_AFTER_PREFIX,
331 UNUM_PAD_BEFORE_SUFFIX,
332 UNUM_PAD_AFTER_SUFFIX
334
346
358
359 /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
360 * it is needed for layout of DecimalFormatSymbols object. */
361#ifndef U_FORCE_HIDE_DEPRECATED_API
367#endif // U_FORCE_HIDE_DEPRECATED_API
413
414
415#ifndef U_HIDE_DRAFT_API
437#endif // U_HIDE_DRAFT_API
438
476U_CAPI UNumberFormat* U_EXPORT2
478 const UChar* pattern,
479 int32_t patternLength,
480 const char* locale,
481 UParseError* parseErr,
482 UErrorCode* status);
483
484
491U_CAPI void U_EXPORT2
493
494#if U_SHOW_CPLUSPLUS_API
495
496U_NAMESPACE_BEGIN
497
508
509U_NAMESPACE_END
510
511#endif
512
521U_CAPI UNumberFormat* U_EXPORT2
523 UErrorCode *status);
524
549U_CAPI int32_t U_EXPORT2
551 int32_t number,
552 UChar* result,
553 int32_t resultLength,
554 UFieldPosition *pos,
555 UErrorCode* status);
556
581U_CAPI int32_t U_EXPORT2
583 int64_t number,
584 UChar* result,
585 int32_t resultLength,
586 UFieldPosition *pos,
587 UErrorCode* status);
588
613U_CAPI int32_t U_EXPORT2
615 double number,
616 UChar* result,
617 int32_t resultLength,
618 UFieldPosition *pos, /* 0 if ignore */
619 UErrorCode* status);
620
663U_CAPI int32_t U_EXPORT2
665 double number,
666 UChar* result,
667 int32_t resultLength,
668 UFieldPositionIterator* fpositer,
669 UErrorCode* status);
670
671
700U_CAPI int32_t U_EXPORT2
702 const char * number,
703 int32_t length,
704 UChar* result,
705 int32_t resultLength,
706 UFieldPosition *pos, /* 0 if ignore */
707 UErrorCode* status);
708
739U_CAPI int32_t U_EXPORT2
741 double number,
742 UChar* currency,
743 UChar* result,
744 int32_t resultLength,
745 UFieldPosition* pos,
746 UErrorCode* status);
747
768U_CAPI int32_t U_EXPORT2
770 const UFormattable *number,
771 UChar *result,
772 int32_t resultLength,
773 UFieldPosition *pos,
774 UErrorCode *status);
775
795U_CAPI int32_t U_EXPORT2
797 const UChar* text,
798 int32_t textLength,
799 int32_t *parsePos /* 0 = start */,
800 UErrorCode *status);
801
821U_CAPI int64_t U_EXPORT2
823 const UChar* text,
824 int32_t textLength,
825 int32_t *parsePos /* 0 = start */,
826 UErrorCode *status);
827
847U_CAPI double U_EXPORT2
849 const UChar* text,
850 int32_t textLength,
851 int32_t *parsePos /* 0 = start */,
852 UErrorCode *status);
853
854
882U_CAPI int32_t U_EXPORT2
884 const UChar* text,
885 int32_t textLength,
886 int32_t *parsePos /* 0 = start */,
887 char *outBuf,
888 int32_t outBufLength,
889 UErrorCode *status);
890
910U_CAPI double U_EXPORT2
912 const UChar* text,
913 int32_t textLength,
914 int32_t* parsePos, /* 0 = start */
915 UChar* currency,
916 UErrorCode* status);
917
938U_CAPI UFormattable* U_EXPORT2
940 UFormattable *result,
941 const UChar* text,
942 int32_t textLength,
943 int32_t* parsePos, /* 0 = start */
944 UErrorCode* status);
945
962U_CAPI void U_EXPORT2
964 UBool localized,
965 const UChar *pattern,
966 int32_t patternLength,
967 UParseError *parseError,
968 UErrorCode *status
969 );
970
981U_CAPI const char* U_EXPORT2
982unum_getAvailable(int32_t localeIndex);
983
993U_CAPI int32_t U_EXPORT2
995
996#if UCONFIG_HAVE_PARSEALLINPUT
997/* The UNumberFormatAttributeValue type cannot be #ifndef U_HIDE_INTERNAL_API, needed for .h variable declaration */
1001typedef enum UNumberFormatAttributeValue {
1002#ifndef U_HIDE_INTERNAL_API
1004 UNUM_NO = 0,
1006 UNUM_YES = 1,
1008 UNUM_MAYBE = 2
1009#else
1011 UNUM_FORMAT_ATTRIBUTE_VALUE_HIDDEN
1012#endif /* U_HIDE_INTERNAL_API */
1013} UNumberFormatAttributeValue;
1014#endif
1015
1156
1174U_CAPI int32_t U_EXPORT2
1177
1197U_CAPI void U_EXPORT2
1200 int32_t newValue);
1201
1202
1217U_CAPI double U_EXPORT2
1220
1235U_CAPI void U_EXPORT2
1238 double newValue);
1239
1273
1292U_CAPI int32_t U_EXPORT2
1295 UChar* result,
1296 int32_t resultLength,
1297 UErrorCode* status);
1298
1315U_CAPI void U_EXPORT2
1318 const UChar* newValue,
1319 int32_t newValueLength,
1320 UErrorCode *status);
1321
1338U_CAPI int32_t U_EXPORT2
1340 UBool isPatternLocalized,
1341 UChar* result,
1342 int32_t resultLength,
1343 UErrorCode* status);
1344
1345
1440
1457U_CAPI int32_t U_EXPORT2
1459 UNumberFormatSymbol symbol,
1460 UChar *buffer,
1461 int32_t size,
1462 UErrorCode *status);
1463
1477U_CAPI void U_EXPORT2
1479 UNumberFormatSymbol symbol,
1480 const UChar *value,
1481 int32_t length,
1482 UErrorCode *status);
1483
1484
1494U_CAPI const char* U_EXPORT2
1496 ULocDataLocaleType type,
1497 UErrorCode* status);
1498
1507U_CAPI void U_EXPORT2
1509
1519U_CAPI UDisplayContext U_EXPORT2
1521
1522#endif /* #if !UCONFIG_NO_FORMATTING */
1523
1524#endif
"Smart pointer" class, closes a UNumberFormat via unum_close().
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.
Definition umisc.h:34
A UParseError struct is used to returned detailed information about parsing errors.
Definition parseerr.h:58
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: UFormattable is a thin wrapper for primitive types used for formatting and parsing.
void * UFormattable
Opaque type representing various types of data which may be used for formatting and parsing operation...
C API: Locale.
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested,...
Definition uloc.h:338
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition umachine.h:418
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition umachine.h:269
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition umachine.h:110
C API:misc 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.
Definition unum.h:1017
@ UNUM_GROUPING_SIZE
Grouping size.
Definition unum.h:1039
@ UNUM_LENIENT_PARSE
Lenient parse mode used by rule-based formats.
Definition unum.h:1062
@ UNUM_MIN_SIGNIFICANT_DIGITS
Minimum significant digits.
Definition unum.h:1055
@ UNUM_MAX_INTEGER_DIGITS
Maximum integer digits.
Definition unum.h:1025
@ UNUM_MAX_FRACTION_DIGITS
Maximum fraction digits.
Definition unum.h:1031
@ UNUM_PARSE_NO_EXPONENT
if this attribute is set to 1, specifies that, if the pattern doesn't contain an exponent,...
Definition unum.h:1120
@ UNUM_FORMAT_WIDTH
The width to which the output of format() is padded.
Definition unum.h:1045
@ UNUM_LIMIT_BOOLEAN_ATTRIBUTE
Limit of boolean attributes.
Definition unum.h:1152
@ UNUM_PARSE_INT_ONLY
Parse integers only.
Definition unum.h:1019
@ UNUM_MULTIPLIER
Multiplier.
Definition unum.h:1037
@ UNUM_ROUNDING_INCREMENT
Rounding increment.
Definition unum.h:1043
@ UNUM_PARSE_CASE_SENSITIVE
Parsing: if set to 1, parsing is sensitive to case (lowercase/uppercase).
Definition unum.h:1137
@ UNUM_SIGNIFICANT_DIGITS_USED
Use significant digits.
Definition unum.h:1052
@ UNUM_MINIMUM_GROUPING_DIGITS
Minimum grouping digits; most commonly set to 2 to print "1000" instead of "1,000".
Definition unum.h:1091
@ UNUM_SECONDARY_GROUPING_SIZE
Secondary grouping size.
Definition unum.h:1049
@ UNUM_MIN_FRACTION_DIGITS
Minimum fraction digits.
Definition unum.h:1033
@ UNUM_DECIMAL_ALWAYS_SHOWN
Always show decimal point.
Definition unum.h:1023
@ UNUM_MAX_SIGNIFICANT_DIGITS
Maximum significant digits.
Definition unum.h:1058
@ UNUM_INTEGER_DIGITS
Integer digits.
Definition unum.h:1029
@ UNUM_FRACTION_DIGITS
Fraction digits.
Definition unum.h:1035
@ 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...
Definition unum.h:1130
@ UNUM_SIGN_ALWAYS_SHOWN
Formatting: if set to 1, whether to show the plus sign on non-negative numbers.
Definition unum.h:1146
@ UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS
If 1, specifies that if setting the "max integer digits" attribute would truncate a value,...
Definition unum.h:1113
@ UNUM_CURRENCY_USAGE
if this attribute is set to 0, it is set to UNUM_CURRENCY_STANDARD purpose, otherwise it is UNUM_CURR...
Definition unum.h:1099
@ UNUM_ROUNDING_MODE
Rounding Mode.
Definition unum.h:1041
@ UNUM_SCALE
Scale, which adjusts the position of the decimal point when formatting.
Definition unum.h:1081
@ UNUM_PADDING_POSITION
The position at which padding will take place.
Definition unum.h:1047
@ UNUM_MAX_NONBOOLEAN_ATTRIBUTE
One below the first bitfield-boolean item.
Definition unum.h:1105
@ UNUM_MIN_INTEGER_DIGITS
Minimum integer digits.
Definition unum.h:1027
@ UNUM_GROUPING_USED
Use grouping separator.
Definition unum.h:1021
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.
Definition unum.h:351
@ UNUM_CURRENCY_SPACING_COUNT
One more than the highest normal UCurrencySpacing value.
Definition unum.h:366
@ UNUM_CURRENCY_SURROUNDING_MATCH
Definition unum.h:355
@ UNUM_CURRENCY_MATCH
Definition unum.h:353
@ UNUM_CURRENCY_INSERT
Definition unum.h:357
UNumberFormatRoundingMode
The possible number format rounding modes.
Definition unum.h:282
@ UNUM_ROUND_UNNECESSARY
ROUND_UNNECESSARY reports an error if formatted result is not exact.
Definition unum.h:305
@ UNUM_ROUND_HALFEVEN
Half-even rounding.
Definition unum.h:291
@ UNUM_ROUND_HALF_ODD
Rounds ties toward the odd number.
Definition unum.h:311
@ UNUM_FOUND_HALFEVEN
Half-even rounding, misspelled name.
Definition unum.h:297
@ UNUM_ROUND_HALF_FLOOR
Rounds ties toward -∞.
Definition unum.h:321
@ UNUM_ROUND_HALF_CEILING
Rounds ties toward +∞.
Definition unum.h:316
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.
Definition unum.h:339
@ UNUM_LONG
Definition unum.h:343
@ UNUM_SHORT
Definition unum.h:341
UNumberFormatStyle
The possible number format styles.
Definition unum.h:149
@ UNUM_CURRENCY
Currency format (generic).
Definition unum.h:168
@ UNUM_SCIENTIFIC
Scientific format.
Definition unum.h:178
@ UNUM_CURRENCY_PLURAL
Currency format with a pluralized currency name, e.g., "1.00 US dollar" and "3.00 US dollars".
Definition unum.h:218
@ UNUM_PATTERN_RULEBASED
Rule-based format defined by a pattern string.
Definition unum.h:207
@ UNUM_SPELLOUT
Spellout rule-based format.
Definition unum.h:185
@ UNUM_DECIMAL_COMPACT_SHORT
Decimal format expressed using compact notation (short form, corresponds to UNumberCompactStyle=UNUM_...
Definition unum.h:238
@ UNUM_CASH_CURRENCY
Currency format with a currency symbol given CASH usage, e.g., "NT$3" instead of "NT$3....
Definition unum.h:231
@ UNUM_DECIMAL_COMPACT_LONG
Decimal format expressed using compact notation (long form, corresponds to UNumberCompactStyle=UNUM_L...
Definition unum.h:245
@ UNUM_FORMAT_STYLE_COUNT
One more than the highest normal UNumberFormatStyle value.
Definition unum.h:259
@ UNUM_PERCENT
Percent format.
Definition unum.h:173
@ UNUM_ORDINAL
Ordinal rule-based format .
Definition unum.h:192
@ UNUM_CURRENCY_ISO
Currency format with an ISO currency code, e.g., "USD1.00".
Definition unum.h:212
@ UNUM_NUMBERING_SYSTEM
Numbering system rule-based format.
Definition unum.h:202
@ UNUM_CURRENCY_STANDARD
Currency format with a currency symbol, e.g., "$1.00", using non-accounting style for negative values...
Definition unum.h:252
@ UNUM_DEFAULT
Default format.
Definition unum.h:266
@ UNUM_PATTERN_DECIMAL
Decimal format defined by a pattern string.
Definition unum.h:154
@ UNUM_DURATION
Duration rule-based format.
Definition unum.h:197
@ UNUM_CURRENCY_ACCOUNTING
Currency format for accounting, e.g., "($3.00)" for negative currency amount instead of "-$3....
Definition unum.h:225
@ UNUM_IGNORE
Alias for UNUM_PATTERN_DECIMAL.
Definition unum.h:271
@ UNUM_DECIMAL
Decimal format ("normal" style).
Definition unum.h:159
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.
Definition unum.h:1350
@ UNUM_FOUR_DIGIT_SYMBOL
Four.
Definition unum.h:1405
@ UNUM_PERMILL_SYMBOL
Per mill symbol.
Definition unum.h:1376
@ UNUM_SIGNIFICANT_DIGIT_SYMBOL
Significant digit symbol.
Definition unum.h:1385
@ UNUM_PAD_ESCAPE_SYMBOL
Escape padding character.
Definition unum.h:1378
@ UNUM_INFINITY_SYMBOL
Infinity symbol.
Definition unum.h:1380
@ UNUM_TWO_DIGIT_SYMBOL
Two.
Definition unum.h:1397
@ UNUM_EXPONENTIAL_SYMBOL
The exponential symbol.
Definition unum.h:1374
@ UNUM_CURRENCY_SYMBOL
The currency symbol.
Definition unum.h:1368
@ UNUM_INTL_CURRENCY_SYMBOL
The international currency symbol.
Definition unum.h:1370
@ UNUM_FIVE_DIGIT_SYMBOL
Five.
Definition unum.h:1409
@ UNUM_EXPONENT_MULTIPLICATION_SYMBOL
Multiplication sign.
Definition unum.h:1430
@ UNUM_EIGHT_DIGIT_SYMBOL
Eight.
Definition unum.h:1421
@ UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL
The monetary grouping separator.
Definition unum.h:1389
@ UNUM_PERCENT_SYMBOL
The percent sign.
Definition unum.h:1358
@ UNUM_PATTERN_SEPARATOR_SYMBOL
The pattern separator.
Definition unum.h:1356
@ UNUM_DECIMAL_SEPARATOR_SYMBOL
The decimal separator.
Definition unum.h:1352
@ UNUM_PLUS_SIGN_SYMBOL
The plus sign.
Definition unum.h:1366
@ UNUM_GROUPING_SEPARATOR_SYMBOL
The grouping separator.
Definition unum.h:1354
@ UNUM_NAN_SYMBOL
Nan symbol.
Definition unum.h:1382
@ UNUM_SIX_DIGIT_SYMBOL
Six.
Definition unum.h:1413
@ UNUM_NINE_DIGIT_SYMBOL
Nine.
Definition unum.h:1425
@ UNUM_MINUS_SIGN_SYMBOL
The minus sign.
Definition unum.h:1364
@ UNUM_MONETARY_SEPARATOR_SYMBOL
The monetary separator.
Definition unum.h:1372
@ UNUM_DIGIT_SYMBOL
Character representing a digit in the pattern.
Definition unum.h:1362
@ UNUM_THREE_DIGIT_SYMBOL
Three.
Definition unum.h:1401
@ UNUM_ZERO_DIGIT_SYMBOL
Zero.
Definition unum.h:1360
@ UNUM_ONE_DIGIT_SYMBOL
One.
Definition unum.h:1393
@ UNUM_FORMAT_SYMBOL_COUNT
One more than the highest normal UNumberFormatSymbol value.
Definition unum.h:1437
@ UNUM_SEVEN_DIGIT_SYMBOL
Seven.
Definition unum.h:1417
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...
Definition unum.h:423
@ UNUM_MINIMUM_GROUPING_DIGITS_MIN2
Display grouping using locale defaults, except do not show grouping on values smaller than 10000 (suc...
Definition unum.h:435
@ UNUM_MINIMUM_GROUPING_DIGITS_AUTO
Display grouping using the default strategy for all locales.
Definition unum.h:428
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.
Definition unum.h:1241
@ UNUM_NEGATIVE_PREFIX
Negative prefix.
Definition unum.h:1247
@ UNUM_POSITIVE_PREFIX
Positive prefix.
Definition unum.h:1243
@ UNUM_DEFAULT_RULESET
The default rule set, such as "%spellout-numbering-year:", "%spellout-cardinal:", "%spellout-ordinal-...
Definition unum.h:1262
@ UNUM_PUBLIC_RULESETS
The public rule sets.
Definition unum.h:1271
@ UNUM_PADDING_CHARACTER
The character used to pad to the format width.
Definition unum.h:1251
@ UNUM_CURRENCY_CODE
The ISO currency code.
Definition unum.h:1253
@ UNUM_NEGATIVE_SUFFIX
Negative suffix.
Definition unum.h:1249
@ UNUM_POSITIVE_SUFFIX
Positive suffix.
Definition unum.h:1245
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.
Definition unum.h:144
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.
Definition unum.h:328
U_CAPI void unum_close(UNumberFormat *fmt)
Close a UNumberFormat.
UNumberFormatFields
FieldPosition and UFieldPosition selectors for format fields defined by NumberFormat and UNumberForma...
Definition unum.h:377
@ UNUM_MEASURE_UNIT_FIELD
Definition unum.h:401
@ UNUM_COMPACT_FIELD
Definition unum.h:403
@ UNUM_INTEGER_FIELD
Definition unum.h:379
@ UNUM_PERCENT_FIELD
Definition unum.h:395
@ UNUM_PERMILL_FIELD
Definition unum.h:397
@ UNUM_EXPONENT_SYMBOL_FIELD
Definition unum.h:385
@ UNUM_GROUPING_SEPARATOR_FIELD
Definition unum.h:391
@ UNUM_DECIMAL_SEPARATOR_FIELD
Definition unum.h:383
@ UNUM_SIGN_FIELD
Definition unum.h:399
@ UNUM_CURRENCY_FIELD
Definition unum.h:393
@ UNUM_FRACTION_FIELD
Definition unum.h:381
@ UNUM_FIELD_COUNT
One more than the highest normal UNumberFormatFields value.
Definition unum.h:410
@ UNUM_EXPONENT_SIGN_FIELD
Definition unum.h:387
@ UNUM_EXPONENT_FIELD
Definition unum.h:389
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.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition utypes.h:415