Getting a float from an NSNumberFormatter
Getting a float from an NSNumberFormatter
- Subject: Getting a float from an NSNumberFormatter
- From: Joshua S Emmons <email@hidden>
- Date: Sat, 04 Jan 2003 17:10:53 -0500
I'm sure this must be a frequently asked newbie question, but I can't
find the answer I'm looking for in the archives, so here we go:
I've dropped an NSTextField on a window in IB. Then I've dragged an
NSNumberFormatter onto the text field. I've configured the formatter so
that reasonable values are formatted like "$1,234,221.50". It works fine.
But now I want to get that value as a float. I can get the text value
of the NSTextField, but it has commas and a dollar sign in it. And it's
a NSString. Not good for getting into a float.
I thought that the NSNumberFormatter or NSFormatter classes should have
had some thing that would return a formatted string as a float to me.
Isn't that one of the points of having a formatter? Or maybe I'm
misunderstanding the purpose of NSFormatter and it really is just to
make things display nice and getting values from it is still hard?
So here's my question: how do I get the float I want from the
NSTextField above?
Cheers,
-josh emmons
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.