使用ICU C API显示区域设置货币符号?

时间:2013-12-17 09:35:56

标签: c locale currency icu

我需要知道如何使用ICU4C版本52 C API来显示区域设置货币符号和代码。即($ - USD)

2 个答案:

答案 0 :(得分:0)

如何做到这一点可能有多种方法。这是一个,我认为应该工作(未经测试):

Get the number formatformat the value using it

 UErrorCode success = U_ZERO_ERROR;
 UNumberFormat *nf;
 const char* myLocale = "fr_FR";

 // get locale specific number format
 nf = unum_open( UNUM_CURRENCY, myLocale, success );

 // use it to format the value
 UChar buf[100];
 unum_formatDouble  (nf, 10.0, buf, 100, NULL, &success);   

 // close the format handle
 unum_close(nf);

答案 1 :(得分:0)

或者,更直接地,将ucurr_getName()UCURR_SYMBOL_NAME选择器一起使用。您还可以使用ucurr_forLocale()ucurr_forLocaleAndDate()来获取货币代码,而无需格式化程序。请注意,区域设置可以有多种货币。

相关问题