Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Technology & Software . 1 year ago
Turn Your Knowledge into Earnings.
I am getting a web service repsonse that is an array of dictionary. Each dictionary has objects whose values itself is another dictionary.I need to implement the search within this response,like if i enter "technology" and go for search, I should get those dictionary from the array that has "technology anywhere within that dictionary", Is there a solution to sort out
{ key1 = { 0 = { "id" = 608; "b" = "Apple-Iphone"; }; 1 = { "id" = 609; "b" = "Iphone"; }; 2 = { "id" = 610; "b" = "Show Text"; }; }; key2 = "Technology resources"; "key3" = { 0 = { "id" = 1608; "b" = "I love reading"; }; 1 = { "id" = 1609; "b" = "I prefer iphone to others"; }; 2 = { "id" = 1610; "b" = "Mobile technology is great.I am happy to a be developer"; }; }; "key4" = "Mobile technology is the fun"; }
This is First Method
NSMutableDictionary *dict; NSArray *allKeys = [dict allKeys]; for (NSString *key in allKeys) { NSDictionary *innerDict = [dict objectForKey:key]; NSArray *allInnerKeys = [innerDict allKeys]; for (NSString *innerKey in allInnerKeys) { NSDictionary *mostInnerDict = [dict objectForKey:innerKey]; NSString *b = [mostInnerDict objectForKey:b]; NSString *search = @"Technology"; NSString *sub = [b substringFromIndex:NSMaxRange([b rangeOfString:search])]; if(sub) { // ADD mostInnerDict Object to your Results Array } } }
Or You can Try The Simpler Method
Get Response in NSDATA
Covert NSDATA To NSString
and search in NSSTRING for Substring
General Tech 9 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 2 Answers
Banking, Finance & Insurance
Mobile Technologies
Career Talk
General Tech
Commerce & Accounting
Career Talk0 Answers
General Tech0 Answers
Digital Marketing0 Answers
Internet of Things0 Answers
Interview Questions0 Answers
Your experience on this site will be improved by allowing cookies.