Re: Filter an array

2011-08-05 Thread Sean McBride
On Fri, 29 Jul 2011 09:09:43 -0700, Wade Tregaskis said: Further to earlier answers, bear in mind you've got no guarantee that file extensions are correct, or even exist. Plus of course, you might have both .jpg and .jpeg. You might well be better iterating through, finding the UTI of each file,

Re: Filter an array

2011-07-30 Thread Ken Thomases
On Jul 29, 2011, at 11:09 AM, Wade Tregaskis wrote: for (NSString *path in paths) { NSURL *url = [[NSURL alloc] initFileURLWithPath:path]; NSString *uti = nil; NSError *error = nil; if ([url getResourceValue:uti forKey:NSURLTypeIdentifierKey error:error]) {

Re: Filter an array

2011-07-29 Thread Chris Paveglio
Looks like the method -[NSArray pathsMatchingExtensions:] is case sensitive. I don't have a problem declaring all the variations I need in lower or upper; but I'll see if speed is an issue on a large number of files. The docs don't state whether it's case sensitive or not. Thanks for the

Re: Filter an array

2011-07-29 Thread Wade Tregaskis
Further to earlier answers, bear in mind you've got no guarantee that file extensions are correct, or even exist. Plus of course, you might have both .jpg and .jpeg. You might well be better iterating through, finding the UTI of each file, and working from that. Oooh, that's kind of

Filter an array

2011-07-28 Thread Chris Paveglio
I have an array of file paths, and I need to filter them to return only files with extensions I have in another array. So any files that end with {.tif, .png, .eps} etc.  I'm looking at using: - (NSArray *)filteredArrayUsingPredicate:(NSPredicate *)predicate Is this the best option for this

Re: Filter an array

2011-07-28 Thread Kyle Sluder
On Thu, Jul 28, 2011 at 1:35 PM, Chris Paveglio chris_paveg...@yahoo.com wrote: I have an array of file paths, and I need to filter them to return only files with extensions I have in another array. So any files that end with {.tif, .png, .eps} etc. I'm looking at using: - (NSArray

Re: Filter an array

2011-07-28 Thread Kyle Sluder
Oh, I don't know how I missed this, but there's a very convenient -[NSArray pathsMatchingExtensions:] method already declared in NSPathUtilities.h:

Re: Filter an array

2011-07-28 Thread wadeslists
Oh, I don't know how I missed this, but there's a very convenient -[NSArray pathsMatchingExtensions:] method already declared in NSPathUtilities.h:

Re: Filter an array

2011-07-28 Thread Mike Abdullah
Further to earlier answers, bear in mind you've got no guarantee that file extensions are correct, or even exist. Plus of course, you might have both .jpg and .jpeg. You might well be better iterating through, finding the UTI of each file, and working from that. On 28 Jul 2011, at 21:35, Chris

Re: Filter an array

2011-07-28 Thread Jens Alfke
On Jul 28, 2011, at 1:35 PM, Chris Paveglio wrote: I'm looking at using: - (NSArray *)filteredArrayUsingPredicate:(NSPredicate *)predicate I was going to suggest using a block to filter, but it seems that Foundation collections still don’t implement the standard functional operators like

Re: Filter Multidimensional Array?

2008-05-17 Thread Keary Suska
on 5/16/08 7:40 PM, [EMAIL PROTECTED] purportedly said: I have created a multidimensional array by creating 3 NSArray's (call them childArray1, childArray2, childArray3) and them adding them to one NSArray (call it parentArray). I am using predicate to search out the array which finds the

Filter Multidimensional Array?

2008-05-16 Thread Chris Purcell
I have created a multidimensional array by creating 3 NSArray's (call them childArray1, childArray2, childArray3) and them adding them to one NSArray (call it parentArray). I am using predicate to search out the array which finds the item I'm searching for. However, how I return the name