我是iOS开发中的NewBie。我想解析我的NSURL With Pagination Here my url Like as
http://www.janvajevu.com/webservice/categorylist.php?category=%E0%AA%B8%E0%AB%8D%E0%AA%B5%E0%AA%BE%E0%AA%B8%E0%AB%8D%E0%AA%A5%E0%AA%AF&page=0
我解码此URL就像
一样NSURL *urls = [NSURL URLWithString:@"http://www.janvajevu.com/webservice/categorylist.php?category=%E0%AA%B8%E0%AB%8D%E0%AA%B5%E0%AA%BE%E0%AA%B8%E0%AB%8D%E0%AA%A5%E0%AA%AF&page=0"];
NSString *urlString = [urls absoluteString];
NSLog(@"UrlString %@",urlString);
NSURL * url=[NSURL URLWithString:urlString];
但它只给我一个我想要的网页作为我的网址
NSURL *urls=[NSURL URLWithString:@"My Url &page=%d",pagenum];
在这里,我希望将“我的网址”作为我的原始网址的解码如果可能,那么请给我解决方案。
答案 0 :(得分:3)
NSString *urlString = @"http://www.janvajevu.com/webservice/categorylist.php?category=%E0%AA%B8%E0%AB%8D%E0%AA%B5%E0%AA%BE%E0%AA%B8%E0%AB%8D%E0%AA%A5%E0%AA%AF&page=";
NSURL *targetURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@%d",urlString,pageNumber]];
NSLog(@"targetURL is : %@",targetURL);
答案 1 :(得分:0)
希望这会对你有帮助..
NSString * str = @“http://www.janvajevu.com/webservice/categorylist.php?category=%E0%AA%B8%E0%AB%8D%E0%AA%B5%E0%AA%BE%E0%AA%B8%E0%AB%8D%E0%AA%A5%E0%AA%AF&page=0”;
NSString *result =[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *urls = [NSURL URLWithString:result] ;