Java Currency Code Get getInstance(String currencyCode)

Here you can find the source of getInstance(String currencyCode)

Description

get Instance

License

Open Source License

Declaration

public static Currency getInstance(String currencyCode) 

Method Source Code

//package com.java2s;
/**//from  ww  w.  j  a  va  2  s. co  m
 * This file is part of mycollab-core.
 *
 * mycollab-core is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * mycollab-core 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with mycollab-core.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.Currency;
import java.util.Locale;

public class Main {
    public static Currency getInstance(String currencyCode) {
        try {
            return Currency.getInstance(currencyCode);
        } catch (Exception e) {
            return Currency.getInstance(Locale.US);
        }
    }
}

Related

  1. getCurrency(final String code)
  2. getCurrencyDisplay(Object amount)
  3. getCurrencyNationNumber(double num, int dec)
  4. getCurrencyString(long value)
  5. getDefaultCurrency()