in reply to Sort problems
... sort a long list both alphabetically and numerically. The size of each word is not given and there is not a constant syntax ... The only thing that does repeat itself is the brackets at the end of each word. For example ... a1_1[1] a1_1[2] a1_1[10] a1_2[1] a1_2[2]
... For example, it can be also abc_25_pur5llt[3]
... looks like he cant parse certain words... buff1_12p5u[0]
buff1_100u1 cant come before buff1_25u6
The problem is that you want to combine different types of sorting on different parts of a string, when the format of that string can vary. Until you can clearly define what you need to do, you will not be able to code it. So stop writing code and take a hard look at look at your data. Write a specification that defines the format of the *words* in all cases. From there write a set of rules to define how you want the data sorted.
This exercise should give you the clarity to either write the sorting algorithm you need, or to give us a better explanation of what you're looking for.
|
|---|