I have the following values in a List that is called xAlleles (The values are added to the list as they are read from a file, so they are not necessarily provided in the order that is ultimately required. There is no possibility of them being in the correct order in the file as the files comes from some third party software over which I have no control or influence)
DQB1*03:01
DQB1*03:294
DQB1*03:276N
DQB1*03:292
DQB1*03:297
DQB1*03:87
which I need to get into the following order
DQB1*03:01
DQB1*03:87
DQB1*03:276N
DQB1*03:292
DQB1*03:293
DQB1*03:294
DQB1*03:297
i.e. The values are in ascending numerical order.
I'm aware of the following linq method:-
xAlleles = xAlleles.OrderBy(x => x.Length).ThenBy(x => x).ToList();
This generally works but when the value has an alphabetic suffix (that cannot be removed as it is valid and correct) it places the DQB1*03:276N value at the end of the list rather than in it's position numerically.
I'm sure there's a way to do this but I've spent a long time getting nowhere with it and hope that the community can come up with some suggestions.