ASortFunc Function |
|
Namespace: XSharp.RT
FUNCTION ASortFunc( aTarget AS ARRAY, nStart AS USUAL, nCount AS USUAL, compFunction AS Func<USUAL, USUAL, LONG> ) AS ARRAY
public static Array ASortFunc( Array aTarget, Usual nStart, Usual nCount, Func<Usual, Usual, int> compFunction )
1LOCAL FUNCTION SortFunc(a as usual,b as usual) AS INT 2 if upper(a) < upper(b) 3 return -1 4 elseif upper(a) >> upper(b) 5 return 1 6 endif 7 return 0 8END FUNCTION 9LOCAL testArray AS ARRAY 10testArray := {"Fred", "Kate", "Fred", "ALVIN", "friend"} 11ASortFunc(testArray, 1,ALen(testArray), SortFunc) 12// The sort order after the code has run is ALVIN, Fred, Fred, friend, Kate