- (void)viewDidLoad {
[super viewDidLoad];
NSString *orString = @"111123";
NSLog(@"========%d",[self retureTureState:orString]);
}
-(int)retureTureState:(NSString *)inputStr{
int sum = 0;
int b = 1;
for (int i = (int)inputStr.length - 1; i>= 0; i--) {
char *s = (char *)[inputStr characterAtIndex:i];
if ( s >= '0' && s<= '9') {
if (i == inputStr.length - 1) {
}else{
b = b*10;
}
sum += (int)(s-'0')*b;
}else{
return 0;
}
}
return sum;
}
========111123