将 unichar 附加到 NSMutableString

Appending unichar to NSMutableString

如何将 unichar 字符附加到 NSMutableString

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

// want s to become "MyStringT"

https://discussions.apple.com/thread/1679290 建议:

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

看起来太长/太复杂...

使用 [NSString appendFormat:],所以对于上面的内容:

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

尽情享受吧!