Page 1 of 1
Determine decimal seperator on system
Posted: Mon Sep 21, 2009 5:42 am
by Garrett
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
Posted: Mon Sep 28, 2009 12:09 am
by dickey
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
Posted: Mon Sep 28, 2009 6:14 am
by Garrett
Thanks a bunch Dickey

Posted: Mon Sep 28, 2009 6:56 pm
by bn
Garrett,
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
As far as I know there is either a "," or a "." as decimal separator. And the thousand separator is either "." or ",".
regards
Bernd
Posted: Tue Sep 29, 2009 2:12 am
by Garrett
Thanks Bernd
