Why is currency programming so hard?

One of the most requested ReceiptWallet features was to be able to handle receipts in multiple currencies. OK, simple enough I thought as I could just treat all values as strings so that they have a currency symbol in them. The problem was that I had to verify that the currency symbol was valid and format the value so it is appropriate to that currency, for example, the Japanese Yen doesn’t have decimals in the number. My first pass that this was pretty decent, handled dollars, Euros, Yen and a bunch of other currencies. Turns out this wasn’t a complete implementation. In order to build my list of currencies, I used what are called locales on Mac OS X to get the currency associated with a locale. Problem is that some currencies aren’t associated with a locale, such as Swiss Francs (I have no idea why). So I had to find a way to get a list of currencies and do some formatting magic. I think that I managed to do this, but I just don’t understand why it was so hard. Is it inconceivable that people would want to use multiple currencies on one machine? If it was easy, everyone would have this type of code in their programs!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.