The Sort library provides sorting algorithms.
To use the Sort library, you need to include Sort.bi in your project.
'$INCLUDE:'Sort.bi'
DIM names(1 TO 5) AS STRING
names(1) = "John"
names(2) = "jane"
names(3) = "Peter"
names(4) = "sue"
names(5) = "pete"
Sort_StringArray names()
DIM i AS LONG
FOR i = LBOUND(names) TO UBOUND(names)
PRINT names(i)
NEXT
IF Sort_StringArrayRange(names(), 2, 4, _FALSE, _FALSE) THEN
PRINT "Array was changed"
END IF
FOR i = LBOUND(names) TO UBOUND(names)
PRINT names(i)
NEXTSorts a string array using a non-recursive QuickSort algorithm.
Parameters:
strArr(): The array of strings to sort.l: The lower index of the range to sort (inclusive).u: The upper index of the range to sort (inclusive).wantsAscending:_TRUEfor ascending order,_FALSEfor descending order.caseSensitive:_TRUEfor case-sensitive comparison,_FALSEfor case-insensitive comparison.
Returns:
_TRUE if the array was modified, _FALSE otherwise.
FUNCTION Sort_StringArrayRange%% (strArr() AS STRING, l AS _INTEGER64, u AS _INTEGER64, wantsAscending AS _BYTE, caseSensitive AS _BYTE)A convenience function that sorts the entire string array in ascending, case-sensitive order.
Parameters:
strArr(): The array of strings to sort.
Returns:
_TRUE if the array was modified, _FALSE otherwise.
FUNCTION Sort_StringArray%% (strArr() AS STRING)A convenience SUB that sorts the entire string array in ascending, case-sensitive order.
Parameters:
strArr(): The array of strings to sort.
SUB Sort_StringArray (strArr() AS STRING)