判断字符串是否为数字

#define NUMBERS @"0123456789"

[[NSCharacterSet characterSetWithCharactersInString:NUMBERS]invertedSet];

NSString * filtered = [[string componentsSeparatedByCharactersInSet:cs]componentsJoinedByString:@""];

BOOLISNumber = [string isEqualToString:filtered];


你可能感兴趣的:(字符串)