Spike Lee
Spike Lee

Reputation: 411

NSPredicate compare syntax objective c

I have the following expression

NSPredicate* predicate = [NSPredicate predicateWithFormat:@"value1== %@", variable1];

I want to expand the above expression to compare two values e.g."if((value1==variable1)&&(value2==variable2))

How is this possible?

Upvotes: 1

Views: 340

Answers (1)

JeremyP
JeremyP

Reputation: 86651

NSPredicate* predicate = [NSPredicate predicateWithFormat:@"value1== %@ && value2 == %@", variable1, varible2];

Check out the predicate programming guide.

Upvotes: 2

Related Questions