ListSort Function

Action

ListSort sorts a list based on the type of data it contains and replaces the original list with the sorted list.

Syntax

ListSort (lList [,bOrder])
Variable Description
lList Variable containing the list to be sorted. At the completion of the function, lList contains the sorted list. inout LIST.
bOrder Optional: Whether strings that start with "$" are sorted at the beginning of the list or at the end. FALSE if "$" strings are sorted at the beginning of the list. TRUE if "$" strings are sorted at the end of the list. Default is FALSE. BOOLEAN.

Notes

  • On Windows systems, Silk Test Classic sorts using a dictionary-based algorithm.

  • To sort lists of strings and compare strings by ASCII value, add the line AsciiSort=TRUE to the [Runtime] section of the partner.ini file. This setting also affects the comparison of strings, not just the sorting of lists of strings; see STRING data type for more information about working with strings.

  • ListSort sorts only lists of type BOOLEAN, INTEGER, REAL, STRING, or ENUM. Silk Test Classic raises an exception if the list cannot be sorted.

  • ListSort sorts strings using the 4Test locale. Strings are compared using wcscoll.

Example

[-] LIST liNum = {...}
	[ ] 1 
	[ ] 0 
	[ ] 10 
	[ ] -1 
[ ] ListSort (liNum)
[ ] Print (liNum) // prints: {-1, 0, 1, 10}