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.
我正在使用 iPhone 制作表情符号。我想将“\u1F604”(NSString)之类的东西转换为“\U0001F604”(NSString)格式。
我怎样才能做到这一点?
谢谢, 吉姆。
请尝试以下代码。
NSString* resultTemp = @"\u1F604"; NSData* data = [resultTemp dataUsingEncoding:NSUTF16StringEncoding]; NSString* result = [[NSString alloc] initWithData:data encoding:NSUTF16StringEncoding]; self.detailDescriptionLabel.text = result;