Name

VarIsArray Function

Syntax

function VarIsArray(const V: Variant): Boolean;

Description

VarIsArray returns True if the Variant V is an array, and it returns False otherwise. A Variant array has the varArray bit set in its VarType.

VarIsArray is a real function.

Example

// Return the sum of all the numbers in a 1D array, or if the
// argument is not an array, return its numeric value.
function Sum(const V: Variant): Variant;
var
  I: Integer;
begin
  if VarIsArray(V) then
  begin
    Result := 0.0;
    Assert(VarArrayDimCount(V) = 1);
    for I := VarArrayLowBound(V, 1) to VarArrayHighBound(V, 1) do
      Result := Result + V[I];
  end
  else
    Result := V + 0.0; // Ensure that the result is numeric.
end;

See Also

TVarArray Type, TVarArrayBound Type, VarArrayCreate Function, VarArrayDimCount Function, VarArrayHighBound Function, VarArrayLock Function, VarArrayLowBound Function, VarArrayOf Function, VarArrayRedim Procedure, VarArrayRef Function, VarArrayUnlock Function, Variant Type, VarIsArray Function, VarType Function
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset