Adding unichar to NSMutableString

How to add unichar character to NSMutableString ?

 unichar c = 'T'; NSMutableString *s = [NSMutableString stringWithString:@"MyString"]; // want s to become "MyStringT" 

https://discussions.apple.com/thread/1679290 offers:

 [s appendString:[NSString stringWithCharacters:&c length:1]]; 

It looks too long / complicated ...

+6
source share
1 answer

Use [NSString appendFormat:], so for the above:

 [s appendFormat:@"%C", c]; 

Enjoy it!

+8
source

Source: https://habr.com/ru/post/984466/


All Articles