What I would like to do is to sort a list of textual identifiers (think of a file name for example). The sorting algorithm I'm looking for is a kind of alphabetic sorting, but taking groups into account.
For example, sorting "D1" to "D21" should be:
D1, D2, D3, ..., D21
And not:
D1, D10, D11, D12, ... D2, D20, D21, D3, ...
I've been a lot of time trying to accomplish such way of sorting but still can't find how to do it. The bigger the group the harder it seems.
Is there anyone that could guide me through or give me some pseudo code or code in any language?
Thanks.