views:

19

answers:

1

Heres my Array.

NSArray *arrayData = [[NSArray alloc] initWithObjects:@"1 days", @"7 days", 
    @"14 days", @"28 days", @"1 months", @"2 months", 
    @"3 months", @"4 months", @"6 months", @"1 years", 
    @"2 years", @"once", nil];  

Heres my NSString and my integer.

int interval = 2;
NSString *itype = @"years";

I need to join both the integer + a space + the NSString and match it with the item in the array and get the index number of the array so I can pick the same index from another NSArray.

How do i do this ?

+2  A: 

To join the string and integer:

NSString* yearString = [NSString stringWithFormat:@"%d %@", interval, itype];

And to search the array:

[array indexOfObject:yearString];
Mr. Matt
OK, so wheres the index number ?
Jules
int indexOfObject = [array indexOfObject:yearString]; // :)
Jules