我的应用包含特殊字符β(即测试版)。但它转换为Œ,其值在NSLog()中显示为\ U0152 \ U2264。
如何使用/替换原始符号β?
我的代码是 -
NSString *str = [NSString stringWithUTF8String:"β"];
NSString *temp = [[array2 objectAtIndex:0]valueForKey:@"Class"];
NSString *temp1 = [[array2 objectAtIndex:0]valueForKey:@"Interactions"];
interaction = [temp1 stringByReplacingOccurrencesOfString:str withString:@"β"];
classes = [temp stringByReplacingOccurrencesOfString:str withString:@"β"];
lblClass.text = classes;
lblInteraction.text = interaction;
感谢。
答案 0 :(得分:-1)
这对其他人有帮助。
我已将Œ
符号替换为β
,解决了我的问题,如下所示 -
NSString *temp = [[array2 objectAtIndex:0]valueForKey:@"Class"];
NSString *temp1 = [[array2 objectAtIndex:0]valueForKey:@"Interactions"];
interaction = [temp1 stringByReplacingOccurrencesOfString:@"Œ≤" withString:@"β"];
classes = [temp stringByReplacingOccurrencesOfString:@"Œ≤" withString:@"β"];