public final class CurrencyUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
String |
formatPrice(Double price,
String cur)
Formats a price for its specific locale, depending on the currency code
|
Map<String,String> |
getCurrenciesMap()
Returns a map of all available currencies in the form:
currency code - full currency name and symbol
|
Currency |
getCurrency(String cur)
Returns the currency instance for a given currency code
|
String |
getCurrencyName(String cur,
Locale locale)
Returns the full name of the currency in the language of the given locale.
|
static CurrencyUtils |
getInstance()
Returns an instance of this class
|
Locale |
getLocaleForCountry(String countryCode)
Returns the locale for a given country code.
|
boolean |
isValidCurrency(String cur)
Validate the currency code.
|
public static CurrencyUtils getInstance()
public String formatPrice(Double price, String cur)
price - the amountcur - the 3-letter currency codepublic String getCurrencyName(String cur, Locale locale)
cur - the 3-letter currency codelocale - the localepublic Locale getLocaleForCountry(String countryCode)
countryCode - the 2-letter country codepublic Currency getCurrency(String cur)
cur - the 3-letter currency codepublic Map<String,String> getCurrenciesMap()
public boolean isValidCurrency(String cur)
cur - a 3-letter curency codeCopyright © 2016 Erudika. All rights reserved.