Looking for an elgant way to check if a Key exsists in a dictionary

Viewed 22075

Possible Duplicate:
How to check if an NSDictionary or NSMutableDictionary contains a key?

I can get the an array of the Keys (strings) from the dictionary then loop through it doing a string compare with the Key i want to check for and see if that dictionary contains the key I seek.

But is there a more elegant want to check if the key exists in the dictionary?

        NSArray * keys = [taglistDict allKeys];
        for (NSString *key in keys) 
        {
           // do string compare etc
        }

-Code

3 Answers
Related