mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
ICU-1097 unum currency support
X-SVN-Rev: 8638
This commit is contained in:
parent
dc028412eb
commit
98d23f8592
2 changed files with 14 additions and 1 deletions
|
@ -493,7 +493,9 @@ enum UNumberFormatTextAttribute{
|
|||
/** Negative suffix */
|
||||
UNUM_NEGATIVE_SUFFIX,
|
||||
/** The character used to pad to the format width. */
|
||||
UNUM_PADDING_CHARACTER
|
||||
UNUM_PADDING_CHARACTER,
|
||||
/** The ISO currency code */
|
||||
UNUM_CURRENCY_CODE
|
||||
};
|
||||
typedef enum UNumberFormatTextAttribute UNumberFormatTextAttribute;
|
||||
|
||||
|
|
|
@ -540,6 +540,10 @@ unum_getTextAttribute(const UNumberFormat* fmt,
|
|||
*result = ((DecimalFormat*)fmt)->getPadCharacter();
|
||||
return 1;
|
||||
|
||||
case UNUM_CURRENCY_CODE:
|
||||
res = UnicodeString(((DecimalFormat*)fmt)->getCurrency(), "");
|
||||
break;
|
||||
|
||||
default:
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return -1;
|
||||
|
@ -582,6 +586,13 @@ unum_setTextAttribute( UNumberFormat* fmt,
|
|||
((DecimalFormat*)fmt)->setPadCharacter(*newValue);
|
||||
break;
|
||||
|
||||
case UNUM_CURRENCY_CODE: {
|
||||
char currency[4];
|
||||
val.extract(0, 3, currency, "");
|
||||
currency[3] = 0;
|
||||
((DecimalFormat*)fmt)->setCurrency(currency); }
|
||||
break;
|
||||
|
||||
default:
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue