NSString *string = @"5";
int value = [string intValue];
http://stackoverflow.com/questions/6638085/convert-a-string-into-an-int
NSString *string = @"5";
int value = [string intValue];
http://stackoverflow.com/questions/6638085/convert-a-string-into-an-int
= [yourString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
it will remove all extra space from left as well as right but not from middle
and to remove both white space and \n
use
NSString* result = [yourString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
http://stackoverflow.com/questions/6278593/remove-white-space-from-the-left-of-nsstring