ReDim Shared sa$
(1 To nItems
) 'setup with string array sa$() shared so dont have to pass as parameter For x
= 1 To nItems
' make a random list to sort b$ = ""
b$
= b$
+ Mid$("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.?", (Rnd * 64) \
1 + 1, 1) sa$(x) = b$
Print "Press any to sort" QSort 1, nItems
' modified for QB64 from JB
' This is the best all purpose sort routine around, don't worry how it works, it just does!
' To use this sub rountine store all the string values you want to sort into sa$() array
' call Qsort with Start = 1 and Finish = number of Items in your array
Sub QSort
(Start
, Finish
) 'sa$ needs to be DIM SHARED !!!! array i = Start
j = Finish
x$
= sa$
(Int((i
+ j
) / 2)) i = i + 1
j = j - 1
If i
<= j
Then '<< makes this an ascending sort i = i + 1
j = j - 1
If j
> Start
Then QSort Start
, j
If i
< Finish
Then QSort i
, Finish