c++ - ICU Currency Locale Get Denomination -


is there way probe icu currency locale it's minimal denomination? example us's $0.01, korea (ko_kr) ₩1. thought calling getroundingincrement() on decimalformat object may give me returns 0 both en_us , ko_kr.

you need take on: getminimumfractiondigits() function:

#include <unicode/numfmt.h> #include <unicode/ustream.h> #include <unicode/ustring.h> #include <iostream>  int main() {         uerrorcode e=u_zero_error;         icu::numberformat *fmt = icu::numberformat::createcurrencyinstance(e);         std::cout << fmt->getminimumfractiondigits() << std::endl;         icu::unicodestring str;         std::cout << fmt->format(12345.5678,str) << std::endl;          delete fmt; } 

this output of program different locales, seems need

$ ./a.out 2 $12,345.57 $ lc_all=en_us.utf-8 ./a.out 2 $12,345.57 $ lc_all=ja_jp.utf-8 ./a.out 0 ¥12,346 $ lc_all=ko_kr.utf-8 ./a.out 0 ₩12,346 $ lc_all=ru_ru.utf-8 ./a.out 2 12 345,57 руб. 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -