My god, I think I was on too much coffee when I wrote that. Sorry folks, I’ll 
explain further.
I have an NSTableView with a NSTextfield in it with an NSNumberFormatter 
attached. I wish to display INT values in this Textfield but format them in 
such a way that a decimal point appears 2 digits from the right to make it look 
like my INT “cents” values and being displayed as “dollars.cents”. I’ve read 
the Unicode string formatting docs and it appears that I need to wrap the 
decimal point in quotes to escape it from being a special character however its 
not working. In Interface Builder my string format on the NSNumberFormatter is 
like so;

“#,##0’.’00”

Feed: Cocoa mail archive
Posted on: Monday, 3 November 2008 6:58 PM
Author: Steven Hamilton
Subject: NSNumberFormatter: Display INT as decimal

Hi Folks,
Following on from my previous query regarding decimals and floats,
I've decided to refactor my code to maintain a base component of any
currency in use gnucash stylee. This means all values are kept as INT
for accuracy. However, I wish to display the "cent" amounts as dollars
which means banging a decimal point in 2 digits from the right. Can
NSNumberformatter be made to do this? Display an INT value to make it
look like a decimal without actually turning it into an NSDecimal as
such? And also, accept input that looks like a decimal but is stored
as an INT?


View 
article...<http://www.cocoabuilder.com/archive/message/cocoa/2008/11/3/221792>

________________________________
This e-mail is sent by Suncorp-Metway Limited ABN 66 010 831 722 or one of its 
related entities "Suncorp".
Suncorp may be contacted at Level 18, 36 Wickham Terrace, Brisbane or on 13 11 
55 or at suncorp.com.au.
The content of this e-mail is the view of the sender or stated author and does 
not necessarily reflect the view of Suncorp. The content, including 
attachments, is a confidential communication between Suncorp and the intended 
recipient. If you are not the intended recipient, any use, interference with, 
disclosure or copying of this e-mail, including attachments, is unauthorised 
and expressly prohibited. If you have received this e-mail in error please 
contact the sender immediately and delete the e-mail and any attachments from 
your system.
If this e-mail constitutes a commercial message of a type that you no longer 
wish to receive please reply to this e-mail by typing Unsubscribe in the 
subject line.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to