我有一个字典,其值如图所示,我有书籍 ID 的整数值。如何检查 bookid 是否匹配?
这是我的检查代码
NSMutableDictionary *plistdictionary = [[NSMutableDictionary alloc]initWithContentsOfFile:metaDataPath];
NSMutableArray *notes=[plistdictionary objectForKey:@"usernotes"];
NSLog(@"notes value %@",notes);
NSArray *CollectingBookid=[[NSArray alloc]init];
CollectingBookid=[notes valueForKey:@"bookid"];
NSArray *CollectingPages=[[NSArray alloc]init];
CollectingPages=[notes valueForKey:@"pagenumber"];
NSArray *CollectingNotes=[[NSArray alloc]init];
CollectingNotes=[notes valueForKey:@"notes"];
NSLog(@"collection of book id%@",CollectingBookid);
NSString *bookid=@"95";
NSString *page=@"1";
int c=[CollectingBookid count];
for(int i=0;i<c;i++)
{
NSString *singleBookids=[CollectingBookid objectAtIndex:i];
NSString *singlePage=[CollectingPages objectAtIndex:i];
if([singleBookids isEqualToString:bookid])
{
if([singlePage isEqualToString:page])
{
NSMutableArray *CompleteUserNotes=[[NSMutableArray alloc]init];
CompleteUserNotes=[CollectingNotes objectAtIndex:i];
NSLog(@"Selected Notes%@",CompleteUserNotes);
}
}
}