Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个像 @"anh sẽ đến" 这样的 unicode 字符串。现在我想把它剪成一个字符数组,然后我想把它加入一个字符串并在屏幕上显示。我怎样才能做到这一点?
谢谢。
因为字面量是对象,所以您可以使用[@"anh sẽ đến" UTF8String]它来将其转换为 char 数组,以及[NSString stringWithUTF8String:]用于 char 到 NSString 的转换,但老实说,使用它可能+[NSString stringWithFormat:@"anh sẽ đến%c", myUnichar]比在字符串容器之间来回切换更容易。
[@"anh sẽ đến" UTF8String]
[NSString stringWithUTF8String:]
+[NSString stringWithFormat:@"anh sẽ đến%c", myUnichar]