Currently, I’m setting DecimalSeparator to a ‘.’ in each procedure which uses these functions.
It would be much easier to set this globally at the start of the program but I found Delphi seems to periodically set this back to the current locale.
I need to make sure that a decimal point is used for all conversions no matter which country the program is used in as this is the standard for this type of program and all files structure and communication protocols, numeric displays in forms/edits etc are required to be formatted in this way.
I’ve been told in another thread that using decimalseparator is not the correct way to do it but I was not given any alternatives. The other threads concerning this subject that I’ve read don’t seem to offer any formative guidance or are overly complex.
Is there a simple ‘correct’ way to do this ?
I am/was under the assumption that the global
DecimalSeperatorvariable would not be touched by the RTL. If not, then all these routines have an optional parameterFormatSettingswhich you could use. Globaly declare aTFormatSettingsvariable and use it for each occurance of these routines.A small benefit of it could be that the routines are thread-safe when you specify your own format settings.