How to determine an array index in Objective C?

Xcoder picture Xcoder · Jul 16, 2009 · Viewed 16.8k times · Source

I have two arrays in Objective C and I need to find what index something is so I can insert it in the same place. For instance, lets say I have a "name array" and an "age array". How do I find out what index "charlie" is in the "name array" so I know where to insert his age in the "age" array?

Thanks

Answer

Chuck picture Chuck · Jul 16, 2009

-[NSArray indexOfObject:] would seem to be the logical choice.