如何将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]];
看起来太长/太复杂......
答案 0 :(得分:8)
使用[NSString appendFormat:],所以对于上面的内容:
[s appendFormat:@"%C", c];
享受!