Access to an NSMutableArray based on a string lookup, then write to NSLog some o...
source link: https://www.codesd.com/item/access-to-an-nsmutablearray-based-on-a-string-lookup-then-write-to-nslog-some-of-the-objects.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Access to an NSMutableArray based on a string lookup, then write to NSLog some of the objects
I am trying to search an NSMutableArray, which has been initialised with calendar events from the event store. I am specifically wanting to search the array for the string "office", which will of been entered in some of the calendar entries for the "location" property. Then l need to write to the NSLog the following specific values from each of the return events:
Event title Event start time Event end time Event location
Thanks in advance!
You could use NSPredicate, it is easy and very fast
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"publisher == %@", @"Apress" ];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"publisher containts[cd] %@", @"Apress" ];
NSArray *filtered = [bookshelf filteredArrayUsingPredicate:predicate];
Related Articles
Access a specific label based on a string
Need to parse the separated string by two points and eliminate some of the string if found the match in plsql
The variable is defined as a string but not defined as a property of the object
How to find an object Based on a certain attribute in ArrayList and edit the object
How does NSMutableArray change the object index that you use removeObjectAtIndex?
Convert a string into dotted notation to get the reference of the object
Python: variable to access the orientation of the object?
The Objective-c return method returns NSMutableArray instead of the declared return type NSArray
The string inversion program produces a new line at the beginning of the output
to serialize the object into XML String using .NET
Javascript: how to access an object based on a string associated with this object?
How do I access the members of a struct based on a string value?
Constant specific method using Enums OR Reflection? Need to invoke methods based on a string
How to access R.string.xxx resources from a method by passing the 'xxx' string as a parameter to this method?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK