Array.Compare |
Top Previous Next |
Syntax function Array.Compare(Array1: array; Array2: array [; var DiffIndex: integer): integer
Alternative Names
Description Compares arrays Array1 and Array2 against each other. The following return values are possible:
If the return value is 2, the optional DiffIndex parameter contains the array index with the first different value.
Example execute UDSBlock returns (length_value integer, single_array_value varchar(100)) as begin a1 = Array.Create(1, 'two', 3, 'four', 5, 'six'); a2 = Array.Create(1, 'two', 3, 'four', 5, 'six');
/* returns 0 */ cmpresult = Array.Compare(a1, a2);
a1[3] = 1; /* returns 2, diffindex 3 */ cmpresult = Array.Compare(a1, a2, diffindex);
/* make array1 smaller */ Array.SetLength(a1, 4); /* returns -1 */ cmpresult = Array.Compare(a1, a2); end |