本文介绍了将unichar附加到NSMutableString的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将 unichar
字符附加到 NSMutableString
?
unichar c = 'T';
NSMutableString *s = [NSMutableString stringWithString:@"MyString"];
// want s to become "MyStringT"
建议:
[s appendString:[NSString stringWithCharacters:&c length:1]];
看起来太长/复杂...
Looks too long / complicated...
推荐答案
使用[NSString appendFormat:],因此:
Use [NSString appendFormat:], so for above:
[s appendFormat:@"%C", c];
享受!
这篇关于将unichar附加到NSMutableString的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!