Questions tagged [currency]

Currency is a medium of exchange of value, usually referring to government issued denominations.

The Currency tag is relevant to any topic that involves the handling of currency, including accurate calculation, rounding schemes, best practices and display formatting. It is also applicable to discussions of how specific languages or libraries handle currency.

http://en.wikipedia.org/wiki/Currency

2964 questions
48
votes
6 answers

How to get currency symbol by currency name?

I want get Currency symbol (like $ or £) by currency name (like USD or EUR). For English(US) I can get symbol (if English(US) set as language on device): Currency currency = Currency.getInstance(Locale.getDefault()); String symbol =…
MyNameIs
  • 832
  • 1
  • 8
  • 19
48
votes
3 answers

WPF StringFormat={0:C} showing as dollars

Why does this line of code Output the result as $xx.xx when all my regional settings are set to UK. I expect it to output it as £xx.xx. Any ideas? I have tried different variations of the…
Coesy
  • 936
  • 1
  • 10
  • 30
47
votes
8 answers

API For Direct Deposit (ACH, EFT, Whatever)

I'm looking for a way to automate a transfer from one bank account to another, without the end user having to login to something like paypal or amazon payments to complete the process (by transferring their on-line balance to their bank account).…
Tim Lytle
  • 17,549
  • 10
  • 60
  • 91
46
votes
3 answers

Convert any currency string to double

I need to store multiple currencies in SQL server. I understand that SQL won't support all different types of currencies (unless I store it as a string, but I don't want to do that). My idea was to convert all the values from their currency format…
James
  • 80,725
  • 18
  • 167
  • 237
45
votes
8 answers

A realistic example where using BigDecimal for currency is strictly better than using double

We know that using double for currency is error-prone and not recommended. However, I'm yet to see a realistic example, where BigDecimal works while double fails and can't be simply fixed by some rounding. Note that trivial problems double total =…
maaartinus
  • 44,714
  • 32
  • 161
  • 320
45
votes
6 answers

What class to use for money representation?

What class should I use for representation of money to avoid most rounding errors? Should I use Decimal, or a simple built-in number? Is there any existing Money class with support for currency conversion that I could use? Any pitfalls that I should…
Esteban Küber
  • 36,388
  • 15
  • 79
  • 97
44
votes
14 answers

Javascript number.toLocaleString currency without currency sign

Suppose we have var number = 123456.789; What I want is to display this number in locale 'de-DE' as 123.456,79 in locale 'ja-JP' as 123,457 in locale 'en-US' as 123,456.79 and so on according to user's locale. The problem is that Javascript's…
dMedia
  • 809
  • 1
  • 10
  • 18
43
votes
2 answers

Multi currency - what to store and when to convert?

I have read different Q&A on SO regarding multi currency but none of them are clear to me or do not provide enough details with regards to my use case. Scenario: Company Raddo has 3 branch locations, UK, France and USA. Raddo has base currency US…
42
votes
8 answers

Is there a functionality in JavaScript to convert values into specific locale formats?

Is there a built in function of JavaScript to convert a string into a particular locale (Euro in my case)? E.g. 50.00 should get converted to 50,00 €.
Murtaza Mandvi
  • 10,708
  • 23
  • 74
  • 109
41
votes
8 answers

Unformat money when parsing in PHP

Is there a way to get the float value of a string like this: 75,25 €, other than parsefloat(str_replace(',', '.', $var))? I want this to be dependent on the current site language, and sometimes the comma could be replaced by dot.
cili
  • 1,037
  • 2
  • 19
  • 34
40
votes
11 answers

How to display the currency symbol to the right in Angular

I have to display Euro currency like this : 583 €. But with this code: {{ price | currency:'EUR':true }} I get €583, is there any option in Angular core to move the symbol to right? A lot of european countries use the symbol at the right (France,…
Ekaitz Hernandez Troyas
  • 1,147
  • 2
  • 11
  • 18
39
votes
6 answers

Rounding integers to nearest multiple of 10

I am trying to figure out how to round prices - both ways. For example: Round down 43 becomes 40 143 becomes 140 1433 becomes 1430 Round up 43 becomes 50 143 becomes 150 1433 becomes 1440 I have the situation where I have a price range of say:…
dhardy
  • 993
  • 2
  • 11
  • 22
38
votes
8 answers

Yahoo Finance All Currencies quote API Documentation

I've being using this feed for a long time, I believe Apple does it as well in one of the mac widgets. but what is really curious is that I simply can't find any documentation for it, I've tried google and…
zanona
  • 12,345
  • 25
  • 86
  • 141
38
votes
12 answers

Get currency symbols from currency code with swift

How can I get the currency symbols for the corresponding currency code with Swift (macOS). Example: EUR = €1.00 USD = $1.00 CAD = $1.00 GBP = £1.00 My code: var formatter = NSNumberFormatter() formatter.currencySymbol =…
Geek20
  • 673
  • 1
  • 9
  • 18
38
votes
2 answers

Regex currency validation

I need Help for currency regex in jQuery function. It optionally allows "$" sign only one time in beginning. It allows comma as digital-group-separator, but not in the beginning or the end. It allows only 2 digits rounded after decimal point. It…
user2205924
  • 471
  • 1
  • 4
  • 8