Java: Currency symbol based on ISO 4217 currency cod

后端 未结 4 445
生来不讨喜
生来不讨喜 2021-02-05 06:45

Below program prints the Currency symbol given the ISO 4217 currency code.

import java.util.*;

public class Currency{

    public static void main(String args[]         


        
4条回答
  •  隐瞒了意图╮
    2021-02-05 07:25

    If someone needs it the other way round (for example € -> EUR)

    String currency = €;
    String currencyCode = "";
    for (Currency c : Currency.getAvailableCurrencies()) {
        if (c.getSymbol().equals(currency)) {
            currencyCode = c.toString();
        }
    }
    

提交回复
热议问题