I have an nsmutable array with 4 objects.no I want to divide that objects into two arrays(or two mutable arrays) based on a condition.
for (NSDictionary *final in SectorsArray)
{
FinalFlightData *ffd = [FinalFlightData new];
ffd.flightnumber = [final objectForKey:@"FLI_NUM"];
ffd.airlineCode = [final objectForKey:@"ARL_COD"];
ffd.departureAirport = [final objectForKey:@"DepartureAirport"];
ffd.departureDay = [final objectForKey:@"DepartureDay"];
ffd.departureDate = [final objectForKey:@"DepartureDate"];
ffd.departureTime = [final objectForKey:@"DepartureTime"];
ffd.arrivalAirport = [final objectForKey:@"ArrivalAirport"];
ffd.arrivalDay = [final objectForKey:@"ArrivalDay"];
ffd.arrivalDate = [final objectForKey:@"ArrivalDate"];
ffd.arrivalTime = [final objectForKey:@"ArrivalTime"];
[testingArray addObject:ffd];
}
so this testing nsmutable array has four objects.now I want to like this.
OutboundArray = [NSMutableArray array];
InboundArray = [NSMutableArray array];
NSString *myString;
if([myString isEqualtoString:@"false"])
{
//in here I want to put first two objects of testingArray into OutboundArray and last two objects of testingArray into InboundArray
}
else if([myString isEqualtoString:@"true"])
{
//in here I want to put first three objects of testingArray into OutboundArray and last object of testingArray into InboundArray
}
else
{
//in here I want to put first object of testingArray into OutboundArray and last three objects of testingArray into InboundArray
}
how can I do this.hope your help.thanx