Instead it would make way more sense to respect the locale settings. Here are just a few example on how that would look like with different language settings:
Code: Select all
US English 123,456.789
French 123 456,789
German 123.456,789
Hindi 1,23,456.789
Please make it possible to format the number by a locale string like `de_DE` or something like that. And if the argument was not provided just use the settings set by the environment variables. In my case there is the environment variable `LANG=de_DE.UTF-8` and therefore numbers should be formatted like this: "123.456,789".
Since we are talking about localization it would also be nice to have a function like `FormatCurrency` which is able to set the currency symbol to the right place, depending on the currency and the localization settings.
In the past I worked a lot with the `locale` library of Pyhon3 for a few multi language projects. You can get inspiration there if you need it: https://docs.python.org/3/library/locale.html
I am sure there is also something similar available in C or some dynamic library on each operating system that can just be wrapped by a convenient Purebasic function.