将UTF-16/32 unicode NSString转换为UTF16 / 32Char

时间:2016-02-27 12:21:48

标签: unicode nsstring utf-16 utf-32

我有一些存储UTF-16和UTF-32 unicode值的字符串:

NSMutableString *utf16String = [[NSMutableString alloc] init];
[utf16String setString: @"F000"]; //U+F000

NSMutableString *utf32String = [[NSMutableString alloc] init];
[utf32String setString: @"F0000"]; //U+F0000

我想将这些字符串转换为十六进制值的UTF16Char和UTF32Char,以获得与以下相同的结果:

UTF16Char utf16Char = 0xF000;
UTF32Char utf32Char = 0xF0000;

提前感谢您的帮助

0 个答案:

没有答案