# What amount length to expect over all currencies?

I've looked around the questions and formatting prices with different currencies seems to be a recurring problem. I encountered a variation of this issue.

I have figured a format to display the price amount, say `amount currencyCode`. Now my amount will vary depending on the currency, because for instance 1 EUR is worth about 25000 VND. So my item (I treat items of a specific range of values, between 10 and 100 euros) might be displayed as `10 EUR` as well as about `250000 VND`, which show a very different size when displaying it. Also, I ignore the fractional part of the amount.

My question is therefore, is there a maximum length of amount I can expect (I consider my display strategy should be valid for any official currency, and the amount is the equivalent of 1 USD)? Or is there a known display strategy (maybe in Vietnam people only display the number of thousands of Dong, not the number of Dong)?

• Do you only have round euro and dollar prices? I guess you’ll rather have `12.95 EUR` etc., which is a bit closer in string length to `300,000 VND`. Nevertheless, merchants in countries with low currency often do employ shortening strategies, but not everywhere and not always the same. (It’s been less than a year ago and I can’t remember how it was in Vietnam, but pretty sure it wasn’t ‘k’ notation.) – Crissov Oct 30 '15 at 14:56
• @Crissov Good point. In my case I only treat round amounts. I updated my question. – Vince Oct 30 '15 at 15:08
• Or 100 € to 3,316,122.62 Iranian Rial... – Adriano Repetti Oct 30 '15 at 15:31
• Salesforce has a limit of 18 digits. Other cloud solutions use smaller numbers. – Igorek Oct 30 '15 at 17:08

Difference websites give different answers. See this and this.

Part of the issue is that it is constantly changing, so you would be better off not assuming a number. The Dong currently seems to be the highest, but other currencies have been higher in the past.

6,000,000,000 (6*10^9) gold yuan coin was issued by Xinjiang Provincial Bank in 1949, and in Germany in 1923, there was a 100,000,000,000,000 (10^14) mark bill. The Hungarian pengő, pictured above, reached a 2,000,000,000,000,000,000,000 (2*10^21) value.

Of course, these increases occurred in periods of extreme instability. You may decide that your application doesn't need to be designed to work for the currency of the loosing side of world war three. Also, many people in those countries would switch to purchasing in more stable foreign currencies.

In my opinion, don't apply a shortening strategy for the longer currency. Try to find the maximum possible case and the minimum case and design your experience to suit both cases, or make 2 variation for each currency if you are building localized versions for each country.

• My question is specifically how to determine the maximum length of an amount (knowing the amount). – Vince Nov 25 '15 at 9:17
• if its an ecommerce website this is for u can find the most expensive item in vnd and decide on the number of digits the price should have based on that – Ameen Akbar Nov 25 '15 at 9:50
• So my question covers all official currencies, the Vietnam Dong might not be the currency with the biggest length of an amount. – Vince Nov 25 '15 at 10:01
• Localized variations might be a better solution than a one size fits all if this is the case – Ameen Akbar Nov 25 '15 at 10:15

It looks like you're trying to implement a fixed width to a field where the number of character varies from one to six. If you do, there will be an unwanted space in the view which makes the user experience worse. From you example you'd display:

``````The price for this item is      10 EUR.
The price for this item is 250'000 VND.
``````

Instead of trying to find the maximum number of characters in the `amount` field, developers often implement dynamic rendering of content. Not only will it be easier to read, but you will also have a system that is working even if there is a major inflation in a country, that you didn't expect. Currency exchange rates change every day, and we need to address that possibility too.

• I don't think I said how I'm going to display it, that's really not my question. And I actually did not pick any strategy for that. Maybe I'll reduce the font size, maybe I'll cut after X numbers and somehow show a short representation of the remaining numbers. But you have a good point, whatever the strategy I pick, there will always be an unpredictable part. My fallback strategy is not very user-friendly so I'd like to limit its usage, and I thought there was an easy way I didn't know about. – Vince Dec 27 '15 at 10:48