Sorting numerical strings

Post Reply
User avatar
Dutchman
Posts: 851
Joined: Mon May 06, 2013 9:21 am
My devices: iMac, iPad Air, iPhone
Location: Netherlands
Flag: Netherlands

Sorting numerical strings

Post by Dutchman »

Sorting a string-array gave strange but correct results considering the string-'value'
I made a 'repair' on the BubbleSort$-function for numerical strings.
The Test-program with both functions gave the following result

Code: Select all

Array to be sorted:
Example      -1           
data         -5           
to           -10          
show         -20          
strange      1            
but          5            
correct      10           
results      20           

With second column sorted:
Example      -1           
to           -10          
show         -20          
data         -5           
strange      1            
correct      10           
results      20           
but          5            

With adapted sort-function:
show         -20          
to           -10          
data         -5           
Example      -1           
strange      1            
but          5            
correct      10           
results      20           
The program is attached to this post
Attachments
StringSortErrorRepair.txt
(2.08 KiB) Downloaded 324 times

Post Reply