I'd like to know if there's a way to determine the decimal separator for any given system and platform that my program may be working on.
When doing division I need to find out what character is being used as the decimal character. I know in the USA we use a period and from what I understand, in the UK a comma is used.
Does anyone know if there is a way to determine what character is being used for the decimal?
Thanks,
~Garrett
Determine decimal seperator on system
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Determine decimal seperator on system
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Determine decimal seperator on system
Hello Garrett,
I hate to see a question go 43 views without an attempt to answer it.
You can query, delete from, and add to the Windows Registry from within Revolution by accessing reg.exe via the shell (a link I found quite useful was http://commandwindows.com/reg.htm). Reg.exe (the cmd line registry editor is nearly always present with the exception of some MS 'Home' branded versions of Windows. Where it is not present there is no barrier from installing it with your app. From memory - I believe the separators like decimal or digit grouping are located under the HKEY_CURRENT_USER\Control Panel\International path in the registry.
For OSX I am unsure.
I hope this helps a little.
Kind regards,
Andrew
I hate to see a question go 43 views without an attempt to answer it.
You can query, delete from, and add to the Windows Registry from within Revolution by accessing reg.exe via the shell (a link I found quite useful was http://commandwindows.com/reg.htm). Reg.exe (the cmd line registry editor is nearly always present with the exception of some MS 'Home' branded versions of Windows. Where it is not present there is no barrier from installing it with your app. From memory - I believe the separators like decimal or digit grouping are located under the HKEY_CURRENT_USER\Control Panel\International path in the registry.
For OSX I am unsure.
I hope this helps a little.
Kind regards,
Andrew
Garrett,
since nobody is coming up with a better solution for the mac you could do it with a little applescript:
As far as I know there is either a "," or a "." as decimal separator. And the thousand separator is either "." or ",".
regards
Bernd
since nobody is coming up with a better solution for the mac you could do it with a little applescript:
Code: Select all
put "set userDecimalSeparator to item 2 of (1.1 as string)" & return & "return userDecimalSeparator" into WhatIsTheSeparator
do WhatIsTheSeparator as applescript
put the result into tDecimalSeparatorMac
replace quote with empty in tDecimalSeparatorMac
-- tDecimalSeparatorMac now contains the user's decimal separator as in his system preferences
-- now you can test for that and adjust the thousand separator accordingly
regards
Bernd