I was wondering how it is possible to validate input from a UITextField in a case such as this:
NSString *str = [UItextfield1 text];
long long value = [str longLongValue];
How do I check first if the number won’t wrap around, and if it is numeric before passing it on?
Don’t check first, check after. The docs for
longLongValuesay that if the string can’t be converted,valuewill be 0. If its magnitude would be too great, you’ll getLLONG_MAXorLLONG_MIN