我有一個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