Reputation: 277
EDIT: Updated code to better reflect my problem
this code returns 9 strings to badDestination1
NSMutableArray* goodDestination1 = [NSMutableArray array];
NSMutableArray* badDestination1 = [NSMutableArray array];
NSMutableArray* badDestination2 = [NSMutableArray array];
for (NSString* item in sourceArray)
{
if ([item rangeOfString:@"<b>"].location != NSNotFound)
[goodDestination1 addObject:item];
else {
[badDestination1 addObject:item];
//[badDestination2 addObject:@"Title"];
}
}
This code returns 1 value to badDestination2
for (NSString* item in sourceArray)
{
if ([item rangeOfString:@"<b>"].location != NSNotFound)
[goodDestination1 addObject:item];
else {
//[badDestination1 addObject:item];
[badDestination2 addObject:@"String"];
}
}
anyone know whats going on? Seems like the "String" might be getting rewritten in the same location on the array maybe?
Upvotes: 3
Views: 219
Reputation: 191905
Looks like you're missing the braces {}
after the else
.
else {
[arrayDestinationBad1 addObject:item];
[arrayDestinationBad2 addObject:@"String"];
}
Upvotes: 5