an array of any kind a comparison function by name as string a swapping function by name as string some optional user defined data (can be vbnull)
the same array sorted
| |
|
|
| |
Implementation
01 function array_order( array_object, comparison_function, swap_function, user_data )
02 dim i: i = array_length( array_object )
03 do while( i >= 0 )
04 i = i - 1
05 dim j: j = 0
06 do while( j < i )
07 dim a: a = j
08 dim b: b = j + 1
09 if( eval( comparison_function + "( array_object, a, b, user_data )" ) > 0 ) then
10 call eval( swap_function + "( array_object, a, b, user_data )" )
11 end if
12 j = j + 1
13 loop
14 loop
15 end function
|
|
| |
|
|
|