Something like:
function AreVariantsEqual(v1, v2: variant): boolean;
Where v1 and v2 can be simple variants but also variant arrays.
Thank you for answering.
It does work but it compares the variant values in a way that may involve
variant conversions. And of course it will fail with variant arrays. There
is no generic way to compare two variants of arbitrary type and content for
equality. You have to build code that handles the possible cases in a
sensible fashion, e.g.
- compare the variant types
- if equal
- do we have variant arrays
- if so, compare the number of elements
- if equal and not a array of variant, compare the values
- if equal and an array of variant, repeat whole process
for each array element
- if no variant array, compare the values
Peter Below (TeamB) 10011...@compuserve.com)
Function VariantCompare(v1,v2:Variant) : Boolean;
Begin
Result := False ;
If (VarType(v1) = VarType(v2)) Then Begin
Result := (v1 = v2) ;
End;
End;
If the Variant Types are the same then compare them, otherwise assume that
they are different because they are different Types.
-Steve-
---------
Rik Netten <"nett...@wxs.nl"@wxs.nl> wrote in message
<69qoag$g4...@forums.borland.com>...
>Does anyone know how to compare to variables of type Variant ?
>(the simple "v1 = v2" does not work).
>