本文介绍了如何在客观的c-iPhone应用程序中搜索nsmutablearray的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在阅读nsmutablearray的RSS提要。我想搜索xml提要。因为我想搜索nsmutablearray。我是iphone应用程序的新手。可以帮助我... ...
I am reading a RSS feed into nsmutablearray. i want to search the xml feed. for that i want to search nsmutablearray. i am very new to iphone apps. can some one helpme with this..
谢谢,
推荐答案
您可以使用谓词来搜索数组,如下所示:
You can do "searching" of arrays using predicates, like so:
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"
你应该看看和文档以获取更多信息。如果您正在处理特定于解析XML的信息(即RSS提要),您应该查看Matt Gallagher关于。
You should look at the NSArray and NSPredicate documentation for more information. If you're after information specific to parsing XML (i.e. an RSS feed), you should check out Matt Gallagher's article on using libxml2 for XML parsing and XPath queries in Cocoa.
这篇关于如何在客观的c-iPhone应用程序中搜索nsmutablearray的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!