filter data from mediawiki api ios

帅比萌擦擦* 提交于 2019-12-01 14:42:33

The response you are getting is in dictionary form. You are then retrieving the value of key "*" which is basically a string. But, that string contains HTML value. This HTML is mainly to show content in UIWebView in our app.

Now, for your question to get value of particular key i.e name, birth_date, etc.:-
The HTML string that we are getting is not definite because it will be changed as you change the input word (searched word), Here, input word is Anil Ambani, but it could be anything and so the response and so the HTML value.
So, I don't think there would be any definite way to get the values of particular key.

Updated:-
To get a substring between two substring, you can use this:-

-(NSString*)useScannerToGetSubstring:(NSString*)strYourString StartString:(NSString*)startString  EndString:(NSString*)endString
{
    NSString * strTest = strYourString;
    NSMutableArray *substrings = [NSMutableArray new];
    NSScanner *scanner = [NSScanner scannerWithString:strTest];
    [scanner scanUpToString:startString intoString:nil]; 
    while(![scanner isAtEnd]) {
        NSString *substring = nil;
        [scanner scanString:startString intoString:nil]; 
        if([scanner scanUpToString:endString intoString:&substring]) {
            [substrings addObject:substring];
        }
        [scanner scanUpToString:startString intoString:nil];
    }
    if ([substrings count]>0) 
    {
        return [substrings objectAtIndex:0];
    }
    return nil;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!