Friday, May 18, 2012

iOS : Convert NSString to Integer or NSNumber

Many beginners struggle to convert an NSString into Integer hence this short example.

Convert NSString to Integer
NSString *string = @"5";
int value = [string intValue];

Convert Integer to NSString

NSString *string = [NSString stringWithFormat:@"%i", theinteger]; 


No comments:

Post a Comment