And what do you want to do if the same page number appears twice?
I don't have the excitement levels to code this at present but would approach this in the following way:
Replace all spaces with nothing
Split into an array
Loop the array to convert the dashes into a series of numbers separated by commas
Convert the array back into a string separated by commas
Split into an array a second time and do a bubblesort to arrange them in ascending order
Convert the final array back into a string separated by commas
You could remove a couple of steps if you converted the initial string into an ado.recordset which simplifies the sorting requirement.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
|