0

I have a JSON data in unicode (like: \u0661\u0660) that I am displaying in my cellForRowAtIndexPath. I need to make the cell of different color when the value key from json is "عشرة ١٠".

Here's the code:

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"];

Is there a way to compare match with item? The containsString, localizedStandardContainsString do not work.

Atif Imran
  • 1,759
  • 2
  • 17
  • 33

1 Answers1

0

You can convert unicode to NSString and than compare it,

refer this link and this link

After converting it to string you can simply check it by,

[your_string isEqualToString:@"your second string"];

Hope this will help you.

Community
  • 1
  • 1
KAR
  • 3,199
  • 3
  • 25
  • 49