2009-06-29 78 views

回答

18

你可以使用谓词阵列的“搜索”,像这样:

NSMutableArray* names = [NSMutableArray arrayWithObjects:@"Andy", @"Bart", @"Bob", nil]; 
NSPredicate* predicate = [NSPredicate predicateWithFormat:@"SELF beginswith[c] 'b'"]; 
NSArray* namesStartingWithB = [names filteredArrayUsingPredicate: predicate]; 
// namesStartingWithB now contains @"Bart" & @"Bob" 

你应该看看NSArrayNSPredicate文档了解更多信息。如果您想了解解析XML(即RSS提要)的具体信息,则应查看Matt Gallagher的文章using libxml2 for XML parsing and XPath queries in Cocoa

+1

添加文档链接 – 2009-07-01 05:18:42

相关问题