Currency code to currency symbol mapping

前端 未结 6 1934
太阳男子
太阳男子 2021-02-07 09:46

Good day, in database there is table with houses for sale records. For each house record there is currency code (in ISO 4217 format) field. Is it possibly to somehow get currenc

6条回答
  •  野的像风
    2021-02-07 10:16

    @artjomka

    I was able to reproduce your problem by setting my default locale to Latvia

    Locale.setDefault(new Locale("lv","LV"));
    Currency c  = Currency.getInstance("EUR");
    System.out.println(c.getSymbol());
    

    This gave me the output of "EUR".

    However, by leaving setting my locale to Uk (already my default) I get the symbol for the Euro(€).

    Locale.setDefault(Locale.UK);
    Currency c  = Currency.getInstance("EUR");
    System.out.println(c.getSymbol());
    

提交回复
热议问题