Skip to content

Instantly share code, notes, and snippets.

@yoman07
Created February 16, 2014 15:30
Show Gist options
  • Save yoman07/9036078 to your computer and use it in GitHub Desktop.
Save yoman07/9036078 to your computer and use it in GitHub Desktop.
Atoi objective-c
- (int) atoi:(char *) str {
if(!str)
NSLog(@"Enter valid string");
int result = 0;
char *p = str;
while((*p>='0') && (*p<='9')) {
result = result*10 + (*p - '0');
p++;
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment