NSPredicate: how to do NOT EndsWith?

Viewed 3896

I have a list of images in the app bundle and need to display appropriate ones in app, the image has the format:

###_photo_#.jpg

###: toy id, from 1000 to 2000
#: photo id, from 1

so for example

1000_photo_1.jpg
1000_photo_2.jpg

I used to get the list of files in the bundle and use a predicate to filter out other files:

@"self ENDSWITH '.jpg' AND self BEGINSWITH '%d_photo_'", toyId

but now there are retina images which end with @2x.jpg, so this method need to be fixed, I am thinking about adding:

NOT ENDSWITH '@2x.jpg'

but is this correct? should I say:

NOT (ENDSWITH '@2x.jpg')

or:

(NOT ENDSWITH '@2x.jpg')

instead?

4 Answers
Related