I have a string that is being generate from a formula, however I only want to use the string as long as all of its characters are numeric, if not that I want to do something dif
It's very simple.
+ (BOOL)isStringNumeric:(NSString *)text { NSCharacterSet *alphaNums = [NSCharacterSet decimalDigitCharacterSet]; NSCharacterSet *inStringSet = [NSCharacterSet characterSetWithCharactersInString:text]; return [alphaNums isSupersetOfSet:inStringSet]; }