當前位置: 首頁>>代碼示例>>Java>>正文


Java Currency.getSymbol方法代碼示例

本文整理匯總了Java中java.util.Currency.getSymbol方法的典型用法代碼示例。如果您正苦於以下問題:Java Currency.getSymbol方法的具體用法?Java Currency.getSymbol怎麽用?Java Currency.getSymbol使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.Currency的用法示例。


在下文中一共展示了Currency.getSymbol方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: formatPrice

import java.util.Currency; //導入方法依賴的package包/類
public static String formatPrice(double price, String currency) {
    String s = null;
    try{
        Currency c = Currency.getInstance(currency);
        s = c.getSymbol(Locale.getDefault());
    }catch (Exception ex){
        s = currency;
    }
    return s+" "+priceFormatter.format(price);
}
 
開發者ID:alextselegidis,項目名稱:easyappointments-android-client,代碼行數:11,代碼來源:Formatter.java

示例2: getCurrencySymbol

import java.util.Currency; //導入方法依賴的package包/類
private static String getCurrencySymbol(final String currencyCode) {
    Currency currency = null;

    try {
        currency = Currency.getInstance(currencyCode);
    } catch (IllegalArgumentException e) {
        // Unknown currency code, ignore.
    }

    return currency != null ? currency.getSymbol() : currencyCode;
}
 
開發者ID:Adyen,項目名稱:adyen-android,代碼行數:12,代碼來源:AmountUtil.java

示例3: ProductAdapter

import java.util.Currency; //導入方法依賴的package包/類
public ProductAdapter(Context context, OnproductClickListener onproductClickListener) {
    this.context = context;
    this.productList = new ArrayList<>();
    this.onproductClickListener = onproductClickListener;
    formatprice = new DecimalFormat("#0,000");

    sharedPref = context.getSharedPreferences(ViMarket.TABLE_USER, Context.MODE_PRIVATE);
    imageWidth = sharedPref.getInt(ViMarket.THUMBNAIL_SIZE,
                                   0);   // Load image width for grid view
    Locale current = new Locale("vi","VN");
    Currency cur = Currency.getInstance(current);
    format = cur.getSymbol();
}
 
開發者ID:sega4revenge,項目名稱:Sega,代碼行數:14,代碼來源:ProductAdapter.java

示例4: MoneyUnit

import java.util.Currency; //導入方法依賴的package包/類
public MoneyUnit(Currency currency, CurrencyConversionProvider currencyConversionProvider) {
	super(100,
			currency.getSymbol(),
			currency.getDisplayName(),
			currency.getDisplayName(),
			ignored -> { throw new InvalidCurrencyException("Cannot convert currencies"); },
			ignored -> { throw new InvalidCurrencyException("Cannot convert currencies"); });

	this.currency = currency;
	this.unitCounter = new UnitCounter(this);
	this.currencyConversionProvider = currencyConversionProvider;
}
 
開發者ID:pedro-borges,項目名稱:Unified-World-Units,代碼行數:13,代碼來源:MoneyUnit.java

示例5: currencySymbol

import java.util.Currency; //導入方法依賴的package包/類
public static String currencySymbol(final String currencyCode) {
    try {
        final Currency currency = Currency.getInstance(currencyCode);
        return currency.getSymbol();
    } catch (final IllegalArgumentException x) {
        return currencyCode;
    }
}
 
開發者ID:guodroid,項目名稱:okwallet,代碼行數:9,代碼來源:GenericUtils.java

示例6: getCurrencySymbolFromProperties

import java.util.Currency; //導入方法依賴的package包/類
private static String getCurrencySymbolFromProperties(Currency currency) {
    if (properties.containsKey(currency.getCurrencyCode()))
        return properties.getProperty(currency.getCurrencyCode()).split(DELIMETER)[CODE];
    return currency.getSymbol();
}
 
開發者ID:piskula,項目名稱:FuelUp,代碼行數:6,代碼來源:CurrencyUtil.java

示例7: setCurrency

import java.util.Currency; //導入方法依賴的package包/類
private void setCurrency()
{
    Currency currency = Currency.getInstance(Locale.getDefault());
    String currencySymbol = currency.getSymbol();
    setText(currencySymbol);
}
 
開發者ID:brarcher,項目名稱:rental-calc,代碼行數:7,代碼來源:CurrencyTextView.java

示例8: setCurrency

import java.util.Currency; //導入方法依賴的package包/類
/**
 * Sets the currency of these DecimalFormatSymbols.
 * This also sets the currency symbol attribute to the currency's symbol
 * in the DecimalFormatSymbols' locale, and the international currency
 * symbol attribute to the currency's ISO 4217 currency code.
 *
 * @param currency the new currency to be used
 * @exception NullPointerException if <code>currency</code> is null
 * @since 1.4
 * @see #setCurrencySymbol
 * @see #setInternationalCurrencySymbol
 */
public void setCurrency(Currency currency) {
    if (currency == null) {
        throw new NullPointerException();
    }
    this.currency = currency;
    intlCurrencySymbol = currency.getCurrencyCode();
    currencySymbol = currency.getSymbol(locale);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:21,代碼來源:DecimalFormatSymbols.java

示例9: setCurrency

import java.util.Currency; //導入方法依賴的package包/類
/**
 * Sets the currency of these DecimalFormatSymbols.
 * This also sets the currency symbol attribute to the currency's symbol
 * in the DecimalFormatSymbols' locale, and the international currency
 * symbol attribute to the currency's ISO 4217 currency code.
 *
 * @param currency the new currency to be used
 * @exception NullPointerException if <code>currency</code> is null
 * @since 1.4
 * @see #setCurrencySymbol
 * @see #setInternationalCurrencySymbol
 */
public void setCurrency(Currency currency) {
    if (currency == null) {
        throw new NullPointerException();
    }
    initializeCurrency(locale);
    this.currency = currency;
    intlCurrencySymbol = currency.getCurrencyCode();
    currencySymbol = currency.getSymbol(locale);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:22,代碼來源:DecimalFormatSymbols.java

示例10: getExchangeRate

import java.util.Currency; //導入方法依賴的package包/類
/**
 * The current price of the variable currency when it is exchanged for 1 unit of the fixed currency.
 * 
 * @param fixed
 *            The currency that is measured in 1 unit.
 * @param variable
 *            The currency thats worth equal to 1 unit of the <code>fixed</code> should be calculated.
 * @return The current exchange rate or an empty {@link Optional} if no exchange rate is known.
 */
public Optional<AccuratePrice> getExchangeRate(final Currency fixed, final Currency variable) {
    final String forexSymbol = fixed.getSymbol() + variable.getSymbol();
    return Optional.ofNullable(store.get(forexSymbol));
}
 
開發者ID:rbi,項目名稱:trading4j,代碼行數:14,代碼來源:ExchangeRateStore.java


注:本文中的java.util.Currency.getSymbol方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。