判断是否纯数字
+ (BOOL)isNumText:(NSString *)string
{
string = [string stringByTrimmingCharactersInSet:[NSCharacterSet decimalDigitCharacterSet]];
if(string.length > 0)
{
return NO;
}
return YES;
}
- (BOOL)isDigit {
NSCharacterSet *alphaNums = [NSCharacterSet decimalDigitCharacterSet];
NSCharacterSet *inStringSet = [NSCharacterSet characterSetWithCharactersInString:str];
return [alphaNums isSupersetOfSet:inStringSet];
}
网友评论