我有NSString =@"KEY3";
和NSMutableDictionary *AllValues ;
,如下所示。我只需要检查字符串是否是AllValues Dictionary
KEY1 {
MLCAvailable = "test";
MLCColorCode = "test2";
NotesCount = "test3";
},
KEY2 {
MLCAvailable = "test";
MLCColorCode = "test2";
NotesCount = "test3";
},
KEY3 {
MLCAvailable = "test";
MLCColorCode = "test2";
NotesCount = "test3";
},
KEY4 {
MLCAvailable = "test";
MLCColorCode = "test2";
NotesCount = "test3";
},
How should i find whether they KEY 3 is present in the given MutableDictionary ?
答案 0 :(得分:4)
你可以尝试获取元素......
if(AllValues[@"KEY3"]) {
//The element exists
}
答案 1 :(得分:1)
你可以在for loop
的帮助下找到它 for (NSString *strKey in [AllValues allKeys]) {
if ([strKey isEqualToString:@"KEY3"]) {
//your condition
}
}
有用吗?