objective c - Sort strings in ascending -


i have array of strings in following format 5_5_a, 10_10_a, 0_0_a 1_1_a etc. want sort them in ascending/descending order. when use sortedarrayusingselector:@selector(compare:) 0_0_a,10_10_a,1_1_a,5_5_a. tried parse each string 5 5 chunks , cast int put first element array addobject:myinteger got warnings when compiling. please let me know if missing something. mark

this because ascii code of '_' bigger '0'.

i don't know if can change '_' '-' example ? fix problem , able use sortedarrayusingselector.

if not can :

[str stringbyreplacingoccurancesofstring:@"_" withstring:@"-"] 

then sort array , replace '-' '_'.

(it solution... not best 1 ^^)


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -