每次将字符串替换为新字符串时,我都会从HTMl
一个字符串到一个字符串。NSString
我试过NSArray
它说NSString
对阵列很强大。我希望将所有字符串NSString
一一存储。我怎样才能做到这一点 ?
TFHpple *tutorialsParser = [TFHpple hppleWithHTMLData:nsData];
NSString *tutorialsXpathQueryString = @"//div[@id='NewsPageArticle']/p/span ";
// NSString *tutorialsXpathQueryString = @"//div[@class='entry']/ul/li/a";
NSArray *tutorialsNodes = [tutorialsParser searchWithXPathQuery:tutorialsXpathQueryString];
// 4
NSMutableArray *newTutorials = [[NSMutableArray alloc] initWithCapacity:0];
for (TFHppleElement *element in tutorialsNodes) {
// 5
Tutorial *tutorial = [[Tutorial alloc] init];
[newTutorials addObject:tutorial];
// 6
tutorial.title = [[element firstChild] content];