8

How do you append a unichar character to NSMutableString?

unichar c = 'T';
NSMutableString *s = [NSMutableString stringWithString:@"MyString"];

// want s to become "MyStringT"

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

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

Looks too long / complicated...

mllm
  • 17,068
  • 15
  • 53
  • 64

1 Answers1

10

Use [NSString appendFormat:], so for above:

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

Enjoy!

mllm
  • 17,068
  • 15
  • 53
  • 64