jason havelock

jason havelock

  • NA
  • 13
  • 617

List of letters and numbers sorting

May 11 2017 2:33 AM
Hi i have a List array with dashes in format of: number (1-99)-Letter(a-z)-number(1-99)-Letter
and i am trying to sort this List 
 
here are some examples:
90-A-4-C
90-A-5-C
10-D-7-V
10-G-19-A
10-G-20-A
30-W-1-K
--- the right arrangement should be:
10-D-7-V
10-G-19-A
10-G-20-A
30-W-1-K
90-A-5-C
90-A-4-C
--because first needs be sorted 1->99, then onto the second a->z, then onto third as group by odd then even, and finally last letter sorted by by a->Z 
 
code example:
List90.Add(09,"A",4,"C","blahblah");
 
to no avail i have been tinkering with something like this:

var result90 = List90.OrderByDescending(a => a.l1).ThenByDescending(a => a.l2).ThenBy(a => a.l3% 2 == 1).ThenByDescending(a => a.l4);

 
Any suggestions? Thank you
 
also the numbers in the string: 90-A-4-C , are like 1,2,10 not 01,02,10
 

Answers (1)