比较两个阿拉伯语单词

时间:2017-04-04 04:59:26

标签: ios objective-c json unicode

我在我的cellForRowAtIndexPath中显示的unicode(例如:\ u0661 \ u0660)中有一个JSON数据。当json的value键为"عشرة ١٠"时,我需要制作不同颜色的单元格。

以下是代码:

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Data" ofType:@"json"];
NSData *data = [NSData dataWithContentsOfFile:filePath];
NSArray *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];

_params = [[json valueForKey:@"data"] valueForKey:@"list"];

的cellForRowAtIndexPath:

NSString *match = @"عشرة  ١٠";
item = [[_params objectAtIndex:indexPath.row] valueForKey:@"value"];

有没有办法比较matchitem? containsString,localizedStandardContainsString不起作用。

1 个答案:

答案 0 :(得分:0)

您可以将unicode转换为NSString,然后将其比较,

参考this linkthis link

将其转换为字符串后,您可以通过

进行检查
[your_string isEqualToString:@"your second string"];

希望这会对你有所帮助。

相关问题