ios - Compare ValueForKey of an array with an NSString -


i have nsstring contains foldername , have array looks this,

data (     {     foldername = posteingang;     id = 13000; },     {     foldername = freigaben;     id = 13001; },     {     foldername = "my drive";     id = 13002; },     {     foldername = gsb;     id = 13164; },     {     foldername = "my folder";     id = 13183; } 

i compare array data nsstring can remove values string not match.

for (nsstring *filename in parseddata)     {          nsrange filenamerange = [filename rangeofstring:searchtext options:nscaseinsensitivesearch];          if (filenamerange.location == nsnotfound) {              [searchdata removeobject:[searchdata valueforkey:@"foldername"]];          }     } 

i have fast enumeration method , have array searchdata. enumeration method looks data in array , if data not found should remove array.the searchdata array displayed in tableview.

i have been trying above method doesn't work.

nsstring *searchtext = @"posteingang"; nspredicate *predicate = [nspredicate predicatewithformat:@"foldername = %@",searchtext]; nsmutablearray *predarr = [nsmutablearray arraywitharray:[yourdataarray filteredarrayusingpredicate:predicate]]; if([predarr count]!=0) {      nslog(@"%@",predarr); } 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -