How to convert int to NSString?
Primitives can be converted to objects with @()
expression. So the shortest way is to transform int
to NSNumber
and pick up string representation with stringValue
method:
NSString *strValue = [@(myInt) stringValue];
or
NSString *strValue = @(myInt).stringValue;
NSString *string = [NSString stringWithFormat:@"%d", theinteger];
int i = 25;
NSString *myString = [NSString stringWithFormat:@"%d",i];
This is one of many ways.