@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;
}
- (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;
}