java.util.Currency.getSymbol()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中java.util.Currency.getSymbol()方法的一些代码示例,展示了Currency.getSymbol()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Currency.getSymbol()方法的具体详情如下:
包路径:java.util.Currency
类名称:Currency
方法名:getSymbol

Currency.getSymbol介绍

[英]Equivalent to getSymbol(Locale.getDefault()). See "Be wary of the default locale".
[中]等效于getSymbol(Locale.getDefault())。请参阅“{$0$}”。

代码示例

代码示例来源:origin: opentripplanner/OpenTripPlanner

public String getSymbol() {
  return value.getSymbol();
}

代码示例来源:origin: opentripplanner/OpenTripPlanner

public String getSymbol(Locale l) {
  return value.getSymbol(l);
}

代码示例来源:origin: shopizer-ecommerce/shopizer

public String getSymbol() {
  return currency.getSymbol();
}

代码示例来源:origin: knowm/XChange

public CoinoneTradeCancelRequest(
  String orderId, BigDecimal price, BigDecimal qty, boolean isAsk, Currency currency) {
 this.orderId = orderId;
 this.price = price;
 this.qty = qty;
 this.isAsk = isAsk;
 this.currency = currency.getSymbol().toLowerCase();
}

代码示例来源:origin: robovm/robovm

/**
 * Equivalent to {@code getSymbol(Locale.getDefault())}.
 * See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>".
 */
public String getSymbol() {
  return getSymbol(Locale.getDefault());
}

代码示例来源:origin: stackoverflow.com

System.out.println(
  Currency.getInstance("USD").getSymbol(Locale.US)
);
// prints $

System.out.println(
  Currency.getInstance("USD").getSymbol(Locale.FRANCE)
);
// prints USD

System.out.println(
  Currency.getInstance("EUR").getSymbol(Locale.US)
);
// prints EUR

System.out.println(
  Currency.getInstance("EUR").getSymbol(Locale.FRANCE)
);
// prints €

代码示例来源:origin: robovm/robovm

/**
 * Sets the currency.
 * <p>
 * The international currency symbol and the currency symbol are updated,
 * but the min and max number of fraction digits stays the same.
 * <p>
 *
 * @param currency
 *            the new currency.
 * @throws NullPointerException
 *             if {@code currency} is {@code null}.
 */
public void setCurrency(Currency currency) {
  if (currency == null) {
    throw new NullPointerException("currency == null");
  }
  if (currency == this.currency) {
    return;
  }
  this.currency = currency;
  intlCurrencySymbol = currency.getCurrencyCode();
  currencySymbol = currency.getSymbol(locale);
}

代码示例来源:origin: robovm/robovm

/**
 * Sets the international currency symbol.
 * <p>
 * The currency and currency symbol are also updated if {@code value} is a
 * valid ISO4217 currency code.
 * <p>
 * The min and max number of fraction digits stay the same.
 *
 * @param value
 *            the currency code.
 */
public void setInternationalCurrencySymbol(String value) {
  if (value == null) {
    currency = null;
    intlCurrencySymbol = null;
    return;
  }
  if (value.equals(intlCurrencySymbol)) {
    return;
  }
  try {
    currency = Currency.getInstance(value);
    currencySymbol = currency.getSymbol(locale);
  } catch (IllegalArgumentException e) {
    currency = null;
  }
  intlCurrencySymbol = value;
}

代码示例来源:origin: robovm/robovm

public void setCurrency(Currency currency) {
  setSymbol(this.address, UNUM_CURRENCY_SYMBOL, currency.getSymbol());
  setSymbol(this.address, UNUM_INTL_CURRENCY_SYMBOL, currency.getCurrencyCode());
}

代码示例来源:origin: knowm/XChange

this.unicode = unicode;
} else if (javaCurrency != null) {
 this.unicode = javaCurrency.getSymbol();
} else {
 this.unicode = commonCode;

代码示例来源:origin: robovm/robovm

try {
  currency = Currency.getInstance(locale);
  currencySymbol = currency.getSymbol(locale);
  intlCurrencySymbol = currency.getCurrencyCode();
} catch (IllegalArgumentException e) {

代码示例来源:origin: stackoverflow.com

DecimalFormat formatter = (DecimalFormat)NumberFormat.getCurrencyInstance();
String symbol = formatter.getCurrency().getSymbol();
formatter.setNegativePrefix(symbol+"-"); // or "-"+symbol if that's what you need
formatter.setNegativeSuffix("");

代码示例来源:origin: stackoverflow.com

System.out.println( currencyCode+ ":-" + currency.getSymbol(currencyLocaleMap.get(currency)));
return currency.getSymbol(currencyLocaleMap.get(currency));

代码示例来源:origin: com.h2database/h2

} else if (c == 'L' || c == 'l' || c == 'U' || c == 'u') {
  Currency currency = Currency.getInstance(Locale.getDefault());
  output.insert(0, currency.getSymbol());
  maxLength += 9;
} else if (c == '$') {
  Currency currency = Currency.getInstance(Locale.getDefault());
  String cs = currency.getSymbol();
  output.insert(0, cs);
} else {

代码示例来源:origin: stackoverflow.com

return getCurrency().getSymbol() + " " + getAmount();
return getCurrency().getSymbol(locale) + " " + getAmount();

代码示例来源:origin: pentaho/pentaho-kettle

String currencyMask = currencyFormat.toLocalizedPattern().replace( "\u00A4", currencyFormat.getCurrency().getSymbol() );
conversionMeta.setConversionMask( currencyMask );
conversionMeta.setTrimType( trimType );
conversionMeta.setDecimalSymbol( String.valueOf( currencyFormat.getDecimalFormatSymbols().getDecimalSeparator() ) );
conversionMeta.setGroupingSymbol( String.valueOf( currencyFormat.getDecimalFormatSymbols().getGroupingSeparator() ) );
conversionMeta.setCurrencySymbol( currencyFormat.getCurrency().getSymbol() );
conversionMeta.setLength( 15 );
int currencyPrecision = currencyFormat.getCurrency().getDefaultFractionDigits();
String currencyMaskAsNumeric = currencyMask.replaceAll( Pattern.quote( currencyFormat.getCurrency().getSymbol() ), "" );
evaluationResults.add( numberUsBuilder.format( currencyMaskAsNumeric, currencyPrecision ).build() );
evaluationResults.add( numberEuBuilder.format( currencyMaskAsNumeric, currencyPrecision ).build() );

代码示例来源:origin: stackoverflow.com

for (Locale ll: Locale.getAvailableLocales()){
  try {
    Currency a = Currency.getInstance(ll);
    Log.v("MyCurrency",a.getCurrencyCode()+"#"+a.getSymbol());
  }catch (Exception e){
    // when the locale is not supported
 }
}

代码示例来源:origin: stackoverflow.com

Locale.setDefault(Locale.UK);
Currency c  = Currency.getInstance("EUR");
System.out.println(c.getSymbol());

代码示例来源:origin: stackoverflow.com

Locale.setDefault(new Locale("lv","LV"));
Currency c  = Currency.getInstance("EUR");
System.out.println(c.getSymbol());

代码示例来源:origin: stackoverflow.com

public class CurrencyTest {
  public static void main(String[] args) throws Exception {
    Locale defaultLocale = Locale.getDefault();
    displayCurrencyInfoForLocale(defaultLocale);

    Locale swedishLocale = new Locale("sv", "SE");
    displayCurrencyInfoForLocale(swedishLocale);
  }

  public static void displayCurrencyInfoForLocale(Locale locale) {
    System.out.println("Locale: " + locale.getDisplayName());
    Currency currency = Currency.getInstance(locale);
    System.out.println("Currency Code: " + currency.getCurrencyCode());
    System.out.println("Symbol: " + currency.getSymbol());
    System.out.println("Default Fraction Digits: " + currency.getDefaultFractionDigits());
    System.out.println();
  }
}

相关文章