I’ve got an AS application that I’m working on that deals with money. I have number formatters set up for the relevant fields. Some of the amounts are calculated and they look fine while in the number formatter, but when I get the contents of the formatter, they sometimes have a bunch of trailing decimals. What looks like “24.95” in the formatter comes out “24.9494” when I want to work with the data.
I’ve tried using the “string value of” modifier when getting contents, that doesn’t seem to work. I’ve also tried this:
on getFormattedText(theObject)
set theValue to the content of theObject
set theFormatter to call method "formatter" of object theObject
set theString to call method "stringForObjectValue:" of object theFormatter with parameter theValue
return theString
end getFormattedText
…which probably does the same thing in Cocoa.
Can’t I get the same rounded number that the formatter shows? Or do I have to do the rounding myself?