NSNumberFormatter validation borked with NSNumberFormatterBehavior10_4?
NSNumberFormatter validation borked with NSNumberFormatterBehavior10_4?
- Subject: NSNumberFormatter validation borked with NSNumberFormatterBehavior10_4?
- From: Matt Neuburg <email@hidden>
- Date: Sat, 08 Jul 2006 15:07:45 -0700
- Thread-topic: NSNumberFormatter validation borked with NSNumberFormatterBehavior10_4?
I'm using an NSNumberFormatter, created in code, to validate a string
entered by the user. I create the NSNumberFormatter, set its characteristics
including its behavior, which I'm setting at NSNumberFormatterBehavior10_4,
and then send it getObjectValue:forString:range:error: to get back a BOOL
telling me whether the string is a valid number according to my criteria.
However, it isn't quite working as advertised.
(1) setAllowsFloats:NO does nothing. I would expect this to mean that a
non-integer would be invalid, but it isn't so. getObjectValue: returns YES.
(2) The docs say that setMaximum:nil will disable checking for maximum
value. But on the contrary, if I setMaximum:nil, checking does occur, and in
fact all values are deemed invalid.
Only the first is really important; I'd like to detect that the number is an
integer. This works just fine if the behavior is
NSNumberFormatterBehavior10_0, so is NSNumberFormatterBehavior10_4 just
broken? I'll be glad to file a bug if this is one.
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden