Many high-level programming languages have built-in features to format a number with a system-dependent currency symbol:
-- Outputs $100.00 (en-US) or € 100,00 (de-AT)
Console.WriteLine(100.ToString("C")); // C#
? FormatCurrency(100) ' VBA
...
I've been developing business software for more than 20 years, and I've not yet found a single use case for this feature.
The thing is: $ 100
is a completely different amount of money than € 100
. If I store 100
in a database field and just "format the value as currency", the user will get a different amount of money depending on their system setting.
Even if I always override the locale, that does not necessarily mean that the currency symbol will stay constant: de-AT
(together with a lot of other locales) switched from ATS
to €
about 20 years ago. In that case, the amount of money displayed would not only vary by locale but also by operating system patch level.
What am I missing? For which use case is this feature actually useful?
Best Answer
Is there a use-case for build-in currency formatting?
Basically, with currencies you have two ways of working:
So yes, there is a use-case for this feature.
But with limitations
This being said, I’m not sure that this standard feature works well and out of the box and in a portable way with:
Although OSes may handle these rather well (e.g.: Windows, macOS), the OS independent programming language implementations are sometimes full of surprises and missing flexibility, which could limit the use-case of this feature, but for other reasons.