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

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

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

Currency.getDisplayName介绍

[英]Equivalent to getDisplayName(Locale.getDefault()). See "Be wary of the default locale".
[中]

代码示例

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

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

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

this.name = name;
} else if (javaCurrency != null) {
 this.name = javaCurrency.getDisplayName();
} else {
 this.name = commonCode;

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

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

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * Gets the name that is suitable for displaying this currency for
 * the default locale.  If there is no suitable display name found
 * for the default locale, the ISO 4217 currency code is returned.
 *
 * @return the display name of this currency for the default locale
 * @since 1.7
 */
public String getDisplayName() {
  return getDisplayName(Locale.getDefault(Locale.Category.DISPLAY));
}

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

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

代码示例来源:origin: com.gluonhq/robovm-rt

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

代码示例来源:origin: ibinti/bugvm

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

代码示例来源:origin: jtulach/bck2brwsr

/**
 * Gets the name that is suitable for displaying this currency for
 * the default locale.  If there is no suitable display name found
 * for the default locale, the ISO 4217 currency code is returned.
 *
 * @return the display name of this currency for the default locale
 * @since 1.7
 */
public String getDisplayName() {
  return getDisplayName(Locale.getDefault(Locale.Category.DISPLAY));
}

代码示例来源:origin: com.bugvm/bugvm-rt

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

代码示例来源:origin: FlexoVM/flexovm

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

代码示例来源:origin: Erudika/para

@Override
public String getCurrencyName(String cur, Locale locale) {
  if (cur != null && currencyToLocaleMap.containsKey(cur.toUpperCase())) {
    return Currency.getInstance(cur.toUpperCase()).getDisplayName((locale == null ? Locale.US : locale));
  } else {
    return "";
  }
}

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

String userInput = "250.00 SEK";
String[] parts = userInput.split(" ");

Currency currency = Currency.getInstance(parts[1]);

System.out.print(currency.getDisplayName());

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

static public void displayCurrency( Locale currentLocale) {

  Double currencyAmount = new Double(9876543.21);
  Currency currentCurrency = Currency.getInstance(currentLocale);
  NumberFormat currencyFormatter = 
    NumberFormat.getCurrencyInstance(currentLocale);

  System.out.println(
    currentLocale.getDisplayName() + ", " +
    currentCurrency.getDisplayName() + ": " +
    currencyFormatter.format(currencyAmount));
}

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

String userInput = "250.00 SEK";
 final Set<Currency> availableCurrencies = Currency.getAvailableCurrencies();
 for (Currency availableCurrency : availableCurrencies) {
   final String currencyCode = availableCurrency.getCurrencyCode();
   final String displayName = availableCurrency.getDisplayName();
   if (userInput.contains(currencyCode)){
     System.out.println("Currency is " + availableCurrency.getDisplayName());
   }
 }

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

static public void displayCurrency( Locale currentLocale) {

  Double currencyAmount = new Double(9876543.21);
  Currency currentCurrency = Currency.getInstance(currentLocale);
  NumberFormat currencyFormatter = 
    NumberFormat.getCurrencyInstance(currentLocale);

  System.out.println(
    currentLocale.getDisplayName() + ", " +
    currentCurrency.getDisplayName() + ": " +
    currencyFormatter.format(currencyAmount));
}

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

Double currencyAmount = new Double(9876543.21);
 Currency currentCurrency = Currency.getInstance(currentLocale);
 NumberFormat currencyFormatter = 
   NumberFormat.getCurrencyInstance(currentLocale);
 System.out.println(
   currentLocale.getDisplayName() + ", " +
   currentCurrency.getDisplayName() + ": " +
   currencyFormatter.format(currencyAmount));

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

Set<Currency> avail = Currency.getAvailableCurrencies();
 for (Currency next : avail) {
   System.out.println("----------------------------------------");
   System.out.println("displayName="+next.getDisplayName());
   System.out.println("currencyCode="+next.getCurrencyCode());
   System.out.println("numericCode="+next.getNumericCode());
   System.out.println("symbol="+next.getSymbol());
   System.out.println("toString="+next.toString());
   System.out.println("----------------------------------------");
 }

代码示例来源:origin: com.tcdng.unify/unify-core

@Override
protected List<ListData> create(Locale locale, Object... params) throws Exception {
  List<ListData> list = new ArrayList<ListData>();
  for (Currency currency : Currency.getAvailableCurrencies()) {
    list.add(new ListData(currency.getCurrencyCode(), currency.getDisplayName(locale)));
  }
  DataUtils.sort(list, ListData.class, "listDescription", true);
  return list;
}

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

Set<Currency> currencies = Currency.getAvailableCurrencies();
 for (Currency currency: currencies) {
   System.out.printf("%s\t%s\t%s\n",currency.getDisplayName(), currency.getSymbol(), currency.toString());
   // your code to check whether the symbol is not empty here
   // add it to your String array or just directly use the
   // CharSequences arrays for entries and values here.
 }

代码示例来源:origin: com.tcdng.unify/unify-core

@Override
public List<? extends Listable> execute(Locale locale, CurrencyListParams params) throws UnifyException {
  if (params.isCurrencyCodes()) {
    List<ListData> list = new ArrayList<ListData>();
    for (String currencyCode : params.getCurrencyCodes()) {
      Currency currency = Currency.getInstance(currencyCode);
      list.add(new ListData(currency.getCurrencyCode(), currency.getDisplayName(locale)));
    }
    DataUtils.sort(list, ListData.class, "listDescription", true);
    return list;
  }
  return currencyListByLocale.get(locale);
}

相关文章