Re: Decimal Separator
Re: Decimal Separator
- Subject: Re: Decimal Separator
- From: Stan Cleveland <email@hidden>
- Date: Mon, 16 May 2011 13:09:29 -0700
Le 15 mai 2011 à 22:19, Luther Fuller a écrit :
> Surely, the decimal separator character is readable from some preference file. But I can't find it!
> I've tried 'defaults -currenthost read' in Terminal and still can't find it.
> The best I can do is ...
>
> set decSep to (character 2 of ((sqrt (2)) as text))
>
> But where is this value stored?
Hi Luther,
I just dug around my system and found nothing on my mostly-default 10.6.7 Mac.
However, it appears that those values don't exist in the system prefs until they are changed to something non-standard. After changing the system preferences for numeric separators, then changing them back, they now appear in the file:
~/Library/Preferences/.GlobalPreferences
The relevant portion (on my Mac) of the string is:
AppleICUNumberSymbols = {
0 = ".";
1 = ",";
};
The zero key is the decimal separator and the one key is the thousands separator.
Once "forced" into the system, this handler will read the values:
on readNumericSeparators()
set {decSep, thouSep} to {missing value, missing value} -- default
try
set prefs to do shell script "defaults read ~/Library/Preferences/.GlobalPreferences AppleICUNumberDumbSymbols"
on error errText
if errText contains "does not exist" then
return {decSep, thouSep}
end if
end try
repeat with thisPref in (paragraphs of prefs)
if thisPref contains "0 = " then
set decSep to character -3 of thisPref
else if thisPref contains "1 = " then
set thouSep to character -3 of thisPref
end if
end repeat
return {decSep, thouSep}
end readNumericSeparators
Stan C. _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden