package org.kodejava.util;
import java.util.Currency;
import java.util.Locale;
public class CurrencySymbol {
public static void main(String[] args) {
Currency currency = Currency.getInstance(Locale.JAPAN);
System.out.println("Japan = " + currency.getSymbol());
currency = Currency.getInstance(Locale.UK);
System.out.println("UK = " + currency.getSymbol());
currency = Currency.getInstance(Locale.US);
System.out.println("US = " + currency.getSymbol());
currency = Currency.getInstance(new Locale("in", "ID"));
System.out.println("Indonesia = " + currency.getSymbol());
}
}
The result of the code snippet above:
Japan = ¥
UK = £
US = $
Indonesia = IDR
Latest posts by Wayan (see all)
- How do I create a string of repeated characters? - September 1, 2023
- How do I convert datetime string with optional part to a date object? - August 28, 2023
- How do I split large excel file into multiple smaller files? - April 15, 2023
Thank you very much for this simple and clear example! Helped me a lot to resolve one problem.