我有一个NSString对象,并希望将其更改为unichar。是否有可能将NSString转换为unichar
int decimal = [[temp substringFromIndex:2] intValue]; // decimal = 12298
NSString *hex = [NSString stringWithFormat:@"0x%x", decimal]; // hex = 0x300a
NSString *chineseChar = [NSString stringWithFormat:@"%C", hex];
// This statement log a different Chinese char every time I run this code
NSLog(@"%@",chineseChar);
当我看到日志时,每次运行我的代码时都会给出不同的字符。 m我错过了什么......?
感谢dude..It就像一个魅力。 – 2011-02-05 11:11:06