ArraySort Function

Action

Sorts the elements in an array.

Syntax

ArraySort(aArray[, iMaxIndex])
Variable Description
aArray A variable containing the array to sort. inout ARRAY of BOOLEAN, INTEGER, REAL, STRING, or ENUM. If aArray is multi-dimensional, you need to specify the sub-array to sort. ArraySort treats each dimension of a multi-dimensional array as an array within an array.
iMaxIndex Optional: The index of the last element to sort. If omitted, the default is the entire array. If you specify iMaxIndex, only the first iMaxIndex elements in aArray are sorted; otherwise, the entire array is sorted. INTEGER.

Notes

On Windows, 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 sorting of lists of strings; see STRING Data Type for more information about working with strings.

ArraySort modifies the array you pass in as aArray.

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

Example

[ ] INTEGER aiTempPerDay[5][4]
[-] testcase arraysort_example ()
	[-] aiTempPerDay = {...} 
		[ ] {10,12, 8, 17} 
		[ ] {-1, 0,17, -9} 
		[ ] {14, 1,1, 0}
		[ ] {75,32, 18, 103} 
		[ ] {9, -7,-2, 3}
	[ ] ArraySort (aiTempPerDay[3]) 
	[ ] Print(aiTempPerDay[3]) // prints: {0,1,1,14} 
	[ ] ArraySort(aiTempPerDay[5], 3) 
	[ ] Print(aiTempPerDay[5]) // prints: {-7,-2,9,3}