当前位置: 首页>>代码示例>>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;未经允许,请勿转载。