How do I get/change decimal separator?

Started by
2 comments, last by SiCrane 12 years, 9 months ago
Hi,

How do I get character that is current system decimal separator.
Unfortunately under MinGW DecimalSeparator variable doesnt work.

Best regards,
Misery.
Advertisement
In Windows you can get the decimal separator of the current system default locale with the GetLocaleInfo() function, passing LOCALE_SYSTEM_DEFAULT as the locale argument and LOCALE_SDECIMAL as the type argument. However, many applications ignore the system default locale, so being able to read it doesn't tell you very much about the behavior of any given program.
Assuming Windows again, if the goal is to write formatted number strings, you should just call GetNumberFormat[Ex]. The standards for how numbers are written vary wildly from locale to locale.

Unfortunately there doesn't seem to be a corresponding function for reading numbers.
-Mike
I don't believe there's a Windows function for reading numbers, but depending on your language there may be a way to read locale formatted numbers. Ex: with C++ you can use the num_get<> locale facet.

This topic is closed to new replies.

Advertisement