PDA

View Full Version : isNumeric function equivalent in Obj-C/iPhone SDK?




atmenterprises
Aug 20, 2008, 02:59 PM
I'm trying to take an input value in a textfield and see if it's actually a numeric value (int or float) before continuing to process the value. Is there any type of function in objective-c that accomplishes this?



atmenterprises
Aug 25, 2008, 06:32 PM
Found the best answer that I could after searching Google over the last few days: isnan() function can take a double and returns a BOOL. I extracted the doubleValue from a textfield and passed it to the isnan() function and it seems to work. Just FYI for any of you that may want this info in the future.

xqterry
Sep 5, 2008, 05:22 AM
Found the best answer that I could after searching Google over the last few days: isnan() function can take a double and returns a BOOL. I extracted the doubleValue from a textfield and passed it to the isnan() function and it seems to work. Just FYI for any of you that may want this info in the future.

thanks