User Tools

Site Tools


k7:k7.4:k7.4.9:start

7.4.9.0 Sorting an array

Sorting an array is to be understood as sorting the individual elements of an array.

  • You can sort native arrays using the method Array. sort ([Mode As Integer]). Arrays of type Variant[] are an exception. Because the elements in such arrays are of different data types, there is no sort (…) method for these arrays per se!

Syntax:

Function Sort ( [ Mode As Integer ] ) As NatDataTyp[]

The Mode argument is optional and can accept one of the following constants:

gb.Ascent 	→ Sort ascending (a...z), standard
gb.Descent	→ Sorting in descending order (z...a)
  • Caution is advised when using the Sort () method with multidimensional arrays. The sort(…)method for arrays is very simple and is characterized by the fact that it sorts the elements of the array linearly - regardless of the number of dimensions.
  • Sorting derived arrays requires the use of the special sorting method for objects: _compare (aO AS Object[]), whose internal source code has to be adjusted individually.
The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k7/k7.4/k7.4.9/start.txt · Last modified: 05.02.2022 (external edit)

Page Tools