#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
/*
char c[] = {"asfhue238df89sf83"};
int count = 0;
for (int i = 0; i < strlen(c); i++) {
if (c[i]>='0'&&c[i]<='9') {
count++;
}
}
printf("%d",count);
*/
NSString *str = @"ad45s6fsa76g8";
int count = 0;
unsigned long m = 0;
for (int i = 0; i < str.length; i++) {
char c = [str characterAtIndex:i];
if (c>='0'&&c<='9') {
count++;
}
}
m = str.length - count;
NSLog(@"%ld",m);
}
return 0;
}
|
|