Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert char to NSString [duplicate]

Possible Duplicate:
Convert from char* to NSString?

I have char myChar = 'r'

How do I convert it to a NSString?

NSString* string = @"r";
like image 634
siamii Avatar asked Oct 29 '11 16:10

siamii


2 Answers

char myChar = 'r';
NSString* string = [NSString stringWithFormat:@"%c" , myChar];
like image 157
Daniel A. White Avatar answered Oct 04 '22 16:10

Daniel A. White


char myChar = 'a';
NSString * string = [NSString stringWithFormat:@"%c", myChar];
like image 44
Fernando Cervantes Avatar answered Oct 04 '22 17:10

Fernando Cervantes