给Nsstring增加一个对象方法:计算某个字符串中的阿拉伯数字的个数

@implementation NSString (Number)


- (int)numCount
{
    int count = 0;    
    for(int i = 0; i < self.length; i++)
    {
        unichar c = [self characterAtIndex:i];
        
        if (c > '0' && c < '9')
        {
            count++;
        }
        
    }
    return count;
}


@end




int main()
{
    int count =[@"ddjee8228jdjujwwuw8w" numCount];
    NSLog(@"%d",count);
    return 0;
}