iphone - NSSortDescriptor sorting with part of key possible? -


i have coredata iphone application view display addresses.

an address looks this: "5 blob street, 2222, suburbia", "5 blob street" address_and_number key, "2222" post code, , "suburbia" suburb.

currently use nssortdescriptor, works fine:

nssortdescriptor *sortdescriptor = [[nssortdescriptor alloc]                                      initwithkey:@"address_and_number" ascending:yes]; 

however, client wants sort street name, i.e. out of address_and_number key, "blob street" evaluated.

is there way such sorting without resorting splitting address_and_number key 2 keys, "address" , "number"?

can use perhaps regular expression grab part of address_and_number key need sorting, , somehow add nssortdescriptor object?

according answer @ relevant question @ custom sorting using categories , core data - supported framework?

sorting inside of nsfetchedresultscontroller performed @ persistent store level if using sqlite backend fail.

for de-normalize data , store month , day of month in addition actual birthdate can sort on them.

after trying both selector , comparator, none of worked persistent level using sqlite3, resorted splitting address_and_number key address_street_name , address_street_number keys, , sorting address_street_name.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -