Note that there are some explanatory texts on larger screens.

plurals
  1. PONSPredicate is not handling single quote so not comparing
    primarykey
    data
    text
    <p>I am using <code>NSPredicate</code> for filtering, I have single quote in the name.</p> <p>I tried to use</p> <pre><code> NSString *keywordWithBackslashedApostrophes = [keyword stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"]; </code></pre> <p>but then it is not comparing as I saw it is comparing <code>Audit's</code> with <code>Audit\</code>'s so it not able to compare. I took strTemp from <code>NSDictionary</code> but <code>NSDictionary</code> converts it into utf-8 code I tried to use <code>[NSPredicate predicateWithFormat:@"MeetingRoomType = %@",strTemp]</code></p> <p>So I am not able to compare string with single quote as if I take from nsdictionary then it automatically converts to utf-8 code and <code>stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"]</code> its not comparing.</p> <p>Please help is there any option to use nspredicate with single quote or I need to use for loop only, as then I will need to change at all places</p> <p>Following is the code for dictionary</p> <pre><code>NSDictionary *dicTemp = [arrTemp lastObject]; [dicTemp setValue:@"Audit's" forKey:@"Meeting"]; [arrTemp addObject:dicTemp]; </code></pre> <p>and in predicate I use <code>[[arrTemp objectAtIndex:i] valueForKey:@"Meeting"];</code></p> <p>Its not comparing</p> <p>I use <code>[NSPredicate predicateWithFormat:@"Meeting = %@",[[arrTemp objectAtIndex:i] valueForKey:@"Meeting"]]</code></p> <p>When I debug I get the utf-8 code instead of apostrophe and it does not come in comparision</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload