Java Currency Code Get getCurrency(final String code)

Here you can find the source of getCurrency(final String code)

Description

get Currency

License

Open Source License

Parameter

Parameter Description
code string with a currency code

Return

a Currency initialized from the parameter code

Declaration

public static Currency getCurrency(final String code) 

Method Source Code

//package com.java2s;
/*/*from w w w .  j  a v a  2 s .  c  o m*/
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 */

import java.util.Currency;

public class Main {
    /**
     * @param code string with a currency code
     * @return a Currency initialized from the parameter code
     */
    public static Currency getCurrency(final String code) {
        return Currency.getInstance(code);
    }

    /**
     * Gets the currency code from the parameter Currency.
     * @param currency Currency to use
     * @return the string with the currency code
     * @since 6.4
     */
    public static String getCurrency(final Currency currency) {
        return currency.getCurrencyCode();
    }
}

Related

  1. countryCodesForCurrency(String c)
  2. currencyFromCode(String currency)
  3. getAvaiableCurrencySymbols()
  4. getCurrencyDisplay(Object amount)
  5. getCurrencyNationNumber(double num, int dec)
  6. getCurrencyString(long value)
  7. getDefaultCurrency()