Example usage for java.util Currency getCurrencyCode

List of usage examples for java.util Currency getCurrencyCode

Introduction

In this page you can find the example usage for java.util Currency getCurrencyCode.

Prototype

public String getCurrencyCode() 

Source Link

Document

Gets the ISO 4217 currency code of this currency.

Usage

From source file:Main.java

public static void main(String args[]) {
    Locale locale = Locale.UK;
    Currency curr = Currency.getInstance(locale);

    System.out.println(curr.getCurrencyCode());
}

From source file:Main.java

public static void main(String args[]) {

    // create a currency object with specified currency code
    Currency curr = Currency.getInstance("USD");

    System.out.println("Currency code :" + curr.getCurrencyCode());
}

From source file:Main.java

public static void main(String args[]) {

    // create a currency object with specified locale
    Locale locale = Locale.GERMANY;
    Currency curr = Currency.getInstance(locale);

    System.out.println("Locale's currency code:" + curr.getCurrencyCode());

}

From source file:Main.java

public static void main(String args[]) {

    // create a currency with eur code
    Currency curr = Currency.getInstance("EUR");

    // get currency code and print it
    String curCode = curr.getCurrencyCode();
    System.out.println("Currency Code is = " + curCode);
}

From source file:Main.java

public static String getSpinnertextCountry(String countryCode) {

    Locale locale = new Locale("", countryCode);
    try {/*from  ww w.  jav  a2s  .  com*/
        Currency currency = Currency.getInstance(locale);
        return locale.getDisplayCountry() + " (" + currency.getCurrencyCode() + ")";
    } catch (Exception e) {

    }
    return "";
}

From source file:Main.java

public static ArrayList<String> getCountriesArray() {
    String[] locales = Locale.getISOCountries();
    ArrayList<String> countries = new ArrayList<String>();
    for (String countryCode : locales) {

        Locale locale = new Locale("", countryCode);
        try {//from w w  w . j  a  v a  2  s  .  c  o  m
            Currency currency = Currency.getInstance(locale);
            countries.add(locale.getDisplayCountry() + " (" + currency.getCurrencyCode() + ")");
        } catch (Exception e) {

        }
    }
    Collections.sort(countries);
    return countries;
}

From source file:com.elasticgrid.model.internal.jibx.Conversion.java

public static String serializeCurrency(Currency currency) {
    return currency.getCurrencyCode();
}

From source file:Main.java

public static String getCountryCode(String spinnerText) {
    String[] locales = Locale.getISOCountries();
    ArrayList<String> countries = new ArrayList<>();
    for (String countryCode : locales) {

        Locale locale = new Locale("", countryCode);
        try {//  ww w . ja v  a  2s .c  o m
            Currency currency = Currency.getInstance(locale);
            String proposedSpinnerText = locale.getDisplayCountry() + " (" + currency.getCurrencyCode() + ")";

            if (proposedSpinnerText.equals(spinnerText)) {
                return countryCode;
            }
        } catch (Exception e) {

        }
    }
    return "";
}

From source file:to.sparks.mtgox.service.UrlFactory.java

public static String getUrlForCommand(Currency currency, Command restCommand) throws Exception {
    return getUrlForCommand(currency.getCurrencyCode(), restCommand);
}

From source file:de.jfachwert.bank.Waehrung.java

/**
 * Gibt die entsprechende Currency als Waehrung zurueck. Da die Anzahl der
 * Waehrungen ueberschaubar ist, werden sie in einem dauerhaften Cache 
 * vorgehalten.//from   ww  w.  j  a va2s. c o m
 * 
 * @param currency Currency
 * @return Waehrung
 */
public static Waehrung of(Currency currency) {
    String key = currency.getCurrencyCode();
    return CACHE.computeIfAbsent(key, t -> new Waehrung(currency));
}