I'm dynamically creating a html table of contents out of multiple html files that I have. Their filenames follow the numbering scheme used by microsoft word.
(i.e.:
1 Title
1.1 Title
1.2 Title
1.2.1 Title)
Currently I'm sorting the numbers by $a cmp $b, but when the numbers get above 10, 10 comes before 2 and X.10 comes before X.2 for example, the sorted list ends up looking like:
1
10
10.1
10.1.1
2 # this section should be able the 10 section
2.1
and also
10.1
10.10
10.11
10.2 # this section should be able the 10.10 section
Any ideas for algorithms?!?
Thanks, (I've exhausted google)
J
(i.e.:
1 Title
1.1 Title
1.2 Title
1.2.1 Title)
Currently I'm sorting the numbers by $a cmp $b, but when the numbers get above 10, 10 comes before 2 and X.10 comes before X.2 for example, the sorted list ends up looking like:
1
10
10.1
10.1.1
2 # this section should be able the 10 section
2.1
and also
10.1
10.10
10.11
10.2 # this section should be able the 10.10 section
Any ideas for algorithms?!?
Thanks, (I've exhausted google)
J