Reputation: 51
I've got two arrays called Array1 & Array2. Array1 is an array filled with custom objects with multiple properties. Array 2 is an array filled with integers.
I'm trying to compare Array1 to Array2, to see if a int property of an object in Array1 matches an int in Array2.
Currently the code I've got is as follows:
for (int i = 0; i < Array1.count; i++) {
Acorn *acorn = [Array1 objectAtIndex:x];
}
Any advice?
Upvotes: 0
Views: 107
Reputation: 1263
Something like this would help, may be!
for (int i = 0; i < Array1.count; i++) {
Acorn *acorn = [Array1 objectAtIndex:i];
if([Array2 containsObject:acorn.intProp]){
// Take this elements in Array 3 and this will be your filtered array.
}
}
Upvotes: 1