currency

Get List of Supported Currencies

孤街浪徒 提交于 2019-12-10 15:54:24
问题 Other than just guessing (like I've done below), is there a more direct and efficient way of reflectively retrieving a list of all currencies supported by your JavaScript environment? function getSupportedCurrencies() { function $(amount, currency) { let locale = 'en-US'; let options = { style: 'currency', currency: currency, currencyDisplay: "name" }; return Intl.NumberFormat(locale, options).format(amount); } const getAllPossibleThreeLetterWords = () => { const chars =

How to use CultureInfo to format deprecated currencies?

一世执手 提交于 2019-12-10 15:09:19
问题 In dotnet, the recommended way of formatting currencies in a culture-specific way, is (as far as I can find): using System.Globalization var info = CultureInfo.GetCultureInfo("en-GB") return string.Format(info, "{0:c}", 1234.5678) This returns: £1,234.57 However. No specific currency is given here. So if Great Britain ever converts to Euro, the same method would suddenly return something like: € 1,234.57 This has just happened to Latvia. This year, it converted to the euro. Various systems

What's the correct currency format in Belgian Dutch?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 14:43:40
问题 I'm formatting some currency in Java. This piece outputs 9,99 € final NumberFormat nf = NumberFormat.getCurrencyInstance(new Locale("nl", "BE")); nf.setCurrency(EUR); nf.format(new BigDecimal("9.99")); but one of our payment providers, which returns amounts preformatted, outputs € 9,99 Which is correct for nl-BE ? And more programming related, if it turns out the payment provider, and not Java, is correct, how do I fix the Java way without hacks per locale (in the real code the Dutch in

Currency to string

流过昼夜 提交于 2019-12-10 12:49:54
问题 Normally I would use string.Format() to get a formatted string. But I got the requirement that all amounts should be printed as text and not digits. i.e. something like: Format(3000, "us"); // => Resulting text: "three thousand dollars" Are there a .NET library which can handle that (russian is mandatory)? 回答1: Are there a .NET library which can handle that (russian is mandatory)? Short answer: No. You have to write your own, I would recommend you to have a look at the following though:

How to get a currency's display name before Android API 19?

情到浓时终转凉″ 提交于 2019-12-10 11:07:52
问题 Currency.getDisplayName(java.util.Locale) is exactly what I want... except it's only available since Android API 19. That's no good as my minSdkVersion < 19. Does anyone know how to get the locale-specific display name for a currency before API 19? Preferably without having to use a third-party library. This question can alternatively be expressed as: How can you get the equivalent of Currency.getDisplayName(java.util.Locale) before Java 7? 来源: https://stackoverflow.com/questions/40349116/how

Django Form values without HTML escape

风流意气都作罢 提交于 2019-12-10 07:33:11
问题 I need to set the Django forms.ChoiceField to display the currency symbols. Since django forms escape all the HTML ASCII characters, I can't get the $ ( € ) or the £ ( £ ) to display the currency symbol. <select id="id_currency" name="currency"> <option value="&#36;">$</option> <option value="&pound;">£</option> <option value="&euro;">€</option> </select> Could you suggest any methods to display the actual HTML Currency character at least for the value part of the option? <select name=

Rounding a number to exactly two decimal places for currency formatting

耗尽温柔 提交于 2019-12-10 03:26:46
问题 I need to round to two decimal places for currency. Both Math.round(num*Math.pow(10,2))/Math.pow(10,2) and Math.round(num*Math.pow(10,2))/Math.pow(10,2) work except it cuts any trailing zero's off so I get 29.9 instead of 29.90 . What is the best way around this? 回答1: You can add this to number which you want to set specific format .toFixed(2) 回答2: (Math.round(num*Math.pow(10,2))/Math.pow(10,2)).toFixed(2) 来源: https://stackoverflow.com/questions/12402273/rounding-a-number-to-exactly-two

Currency Pipe in Angular 2

偶尔善良 提交于 2019-12-10 02:56:38
问题 Hi I want to display price in USD format i.e, for commas for eg. $123,456 But if use currency pipe in angular 2 with USD ,i have to have either $ or USD Is it possible that I can display only number without USD and $? My code is {{123456 | currency:'USD':true:'1.2-2'}} making it to false giving me error. I am getting display as $123,456 or USD123,456. BUT i want it as 123,456. 回答1: Maybe you could just use the DecimalPipe. It seems to cover your needs. {{123456 | number:'.2-2'}} would become

Currency According to Country in android

谁说胖子不能爱 提交于 2019-12-09 23:41:21
问题 I want to show Currency symbol according to current gps location. How can I do this? I am using below code but it always returns $. List<Address> addresses = geocoder.getFromLocation(lat, lng, 1); Address obj = addresses.get(0); Currency cc=Currency.getInstance(obj.getLocale()); 回答1: Are you using the following to obtain the symbol for currency? Currency.getInstance(obj.getLocale()).getSymbol(); Is your obj.getLocale() a valid locale code following ISO_3166-1 and ISO 639-1 like "de_DE".

How do I get the currency symbol of a currency as it would appear in one of its native locales?

為{幸葍}努か 提交于 2019-12-09 19:22:39
问题 Currency currency = Currency.getInstance(currencyCode); How do I get the symbol of the currency as it would appear in one of its native locales as opposed to the default locale? currency.getSymbol() won't work because that will be based of the default locale. currency.getSymbol(Locale locale) won't work because the code will not be able to derive a proper locale based purely on the currencyCode. 回答1: While I agree with you when you said "the code will not be able to derive a proper locale