Solved

# Sorting a list of alphanumeric strings with Visual Basic

Posted on 2003-11-06

Sorting a list of alphanumeric strings with Visual Basic

I have a list of alphanumeric strings that I need to sort. The first 2 digits represent a year 2003 = 03

1998 =98

1988 = 88

And so on. The rest of the digits begin at 01 and go up consecutively, but sometimes there is a – and additional text or numbers. These additional numbers or text does not need to be used in the sorting but the final output still needs to show these numbers. So now I have the job of sorting these numbers into order based on earliest year then numerical through the year. I need some help with the algorithm to do this sorting.

For example

0024

0024-T

0024-12

8814

9812

03114

Would sort to

8814

9812

0024

0024-T

0024-12

03114

I just need some help working out the algorithm; here is a sample of the jobs

0024

0024-T

0026

0026-F

0036-3

0036-E

0062

0062-R

0066-R

0118

0118-A

0140

0140-R

0156

0202

0270

0282

0306

0308

0310

03100

03108

03110

03112

0314

0316

0324

0326

0326-1

0328

0336

0342

0354

0390

0398

8814

8924

9102

9512-6

9540-C

9634-C

9710

9730-13

9730-C

9860-8

9860-R

9934-3