Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This works. You can set your own values here.</p> <pre><code>NSArray *data = [NSArray arrayWithObjects:[NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"ss",@"how", nil] forKeys:[NSArray arrayWithObjects:@"key1",@"key1", nil]],[NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"tt",@"vv", nil] forKeys:[NSArray arrayWithObjects:@"key1",@"key2", nil]],[NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"vv",@"tt", nil] forKeys:[NSArray arrayWithObjects:@"key1",@"key2", nil]],nil]; NSArray *filtered = [data filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"(key1 == %@) AND (key2==%@)", @"tt",@"vv"]]; NSLog(@"%@",filtered); </code></pre> <p>Output:</p> <pre><code>( { key1 = tt; key2 = vv; } ) </code></pre> <p>For clearer explanation:</p> <pre><code>NSMutableDictionary *dict4=[[NSMutableDictionary alloc]init]; [dict4 setObject:@"ss" forKey:@"key1"]; [dict4 setObject:@"how" forKey:@"key2"]; NSMutableDictionary *dict5=[[NSMutableDictionary alloc]init]; [dict5 setObject:@"tt" forKey:@"key1"]; [dict5 setObject:@"vv" forKey:@"key2"]; NSMutableDictionary *dict6=[[NSMutableDictionary alloc]init]; [dict6 setObject:@"vv" forKey:@"key1"]; [dict6 setObject:@"tt" forKey:@"key2"]; NSMutableArray *data = [[NSMutableArray alloc]init]; [data addObject:dict4]; [data addObject:dict5]; [data addObject:dict6]; NSArray *filtered = [data filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"(key1 == %@) AND (key2==%@)", @"tt",@"vv"]]; NSLog(@"%@",filtered); </code></pre> <p>Output:</p> <pre><code>( { key1 = tt; key2 = vv; } ) </code></pre>
 

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