Array.SetLength |
Top Previous Next |
Modifies the length of an existing array.
Syntax function Array.SetLength(AArray: array; ANewLength: integer): integer
Alternative Names
Description SetLength will modify the given array and lengthen or shorten it accordingly. Existing elements are preserved. New elements are initialized with NULL.
AArray holds a previously created array of any length.
ANewLength is the new length for the array.
The Return Value is the new length of the array.
Example execute UDSBlock returns (length_value integer, single_array_value varchar(100)) as begin array_value = Array.Create('zero', 'one', 'two'); single_array_value = array_value[0]; length_value = Array.Length(array_value); suspend; /* returns 3 and 'zero' */
/* extends array with another 2 items */ Array.SetLength(array_value, 5); single_array_value = array_value[3]; length_value = Array.Length(array_value); suspend; /* returns 5 and NULL */ end |