This was from the thread "Re: Same code gives different answers in 2 different scripts"
If you need support in AppleScript for generating formatted strings,
please post an enhancement request (if you havent already) and
include specific details about the sort of controls you need.
Because there already exist formatters for numbers and dates in CoreFoundation.framework one might think AppleScript could have an interface to these existing facilities. I think it would be a relatively easy upgrade to implement.
What might be advantageous is a discussion of the form the new commands might take.
I will try to summarize what is available in CFNumberFormatter.h.
Locales:
You may specify a locale -- this will probably be much appreciated those using non-English setups.
Styles:
Currently available are: none, decimal, currency, percent, scientific, and spell out.
Format:
§
One possibility is to have it look like something we would see in System Events:
set frmt to make new formatter with properties {type:number, locale:"en_US_POSIX", style:decimal, format:"%.9f"}
tell frmt
set numstr to format 0.9
end tell
delete frmt
numstr
But I don't know. Maybe the consensus will be for a command like:
set numstr to format number 0.9 with format:"%.9f" for locale:"en_US_POSIX" using decimal style
Philip Aker
echo
email@hidden@nl | tr a-z@. p-za-o.@
Democracy: Two wolves and a sheep voting on lunch.