How to validate a number string ?
How to validate a number string ?
- Subject: How to validate a number string ?
- From: Bob Miller <email@hidden>
- Date: Thu, 06 Feb 2003 14:29:20 -0500
Hello,
Does anyone know how to do a true numeric validation on an NSString
using Cocoa ? That is, say I have a string 1,234 this is a valid number
but, 1,2,34 is not, likewise 12ABC3 is not. 1.2.34.5.6 is not, etc.
Using NSNumberFormatter along with NSDecimalNumber seem to think that
numbers with incorrectly placed commas and or multiple and incorrectly
placed decimal points are OK. The string 12ABC3 is rejected in fact any
string with alpha in it seems to get rejected by NSNumberFormatter
(with the possible exception of 'e' notation). Is there a validation
method available that will check for true numeric validation ?
Thanks in advance for any help,
Regards,
Bob M.
_______________________________________________
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.