Am 26.06.2009 um 19:17 schrieb Eric E. Dolecki:

This is what I ended up doing:

totalCount = 0;

NSArray *d = [[NSBundle mainBundle] pathsForResourcesOfType:@
"jpg" inDirectory:@"/"];

*// Loop through and find the JPGs that have "image_" in them*
for( int i=0;i<[d count];i++){
NSString *searchForMe = @"image_";
NSString *s = [[NSString alloc] initWithString:[d objectAtIndex:i]];

Why do you copy the path?

NSRange range = [s rangeOfString:searchForMe];

How about hasPrefix: ?

if( range.location != NSNotFound ){
totalCount++;
}
}


NSArray *d = [[NSBundle mainBundle] pathsForResourcesOfType:@"jpg" inDirectory:nil];
for(NSString *s in d)
        if([s hasPrefix:@"image_"])
                totalCount++;


        atze
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to