Projects » VBScript » Quicksort

Quicksort - VBScript

2 Apr 2006
Version: 1.1.1
Download: qsort.txt

A Quicksort class for VBScript that can handle arrays of values or objects.

This QSort class can sort arrays of values (strings, numbers) or objects.

API Reference

Quicksort class

dim sort
set sort = new QSort
Create a new Quicksort object. (You may use any name for this object; it will be called sort in the rest of this documentation.)
set sort.Compare = GetRef("sort_function")
To sort an array of objects, a custom sort function must be specified. Set the Compare property to a function reference to your sort function. To retreive a function reference in VBScript, pass the string name of the function to GetRef.
sort.Order = ORDER_ASC (default)
sort.Order = ORDER_DESC
Set the sort order to ascending (lower values sort first, default) or descending (lower values sort last).
sort.Sort anArray
Sorts anArray in-place.