ios - NSDictionary - Need to check whether dictionary contains key-value pair or not -


I need to follow as something to say that I am a dictionary.

  NSMutableDictionary * xyz = [[NSMutableDictionary alloc] init]; [Xyz Set Valley: @ "Sea" for: @ "S"]; [Xyz Set Valley: @ "Amit" for: @ "A"]; [Xyz Set Valley: @ "Fleas" for: @ "N"]; [Xyz Set Valley: @ "Abhishek": @ "A"]; [Xyz Set Valley: @ "xrox" for: @ "X"];  

Now, I need to check this type of

[xyz has the key "b" value ?? Pair or not?

How is the question?

The second question is how to calculate only the total key-value pair?

For example, say NSInteger mCount = [xyz keyCounts];

just for it objectForKey: @ "b" Ask. If it returns zero , then no object is set on that object.

  if ([xyz objectForKey: @ "b"]) {nslog (set to "@ an object is key" \ "b \"!);} Other {nslog (@ "No object is set for key \" b \ "");}  

edit : According to your edited second question, > NSUInteger is mCount = [xyz count]; Both of these answers are well documented and easily found in class context ().


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -