首页  编辑  

Variant变量的类型

Tags: /超级猛料/Language.Object Pascal/在Delphi编程中使用C语言代码/   Date Created:

获取Variant变量的数据类型

function GetVariantType(const v: variant): string;
begin
 case TVarData(v).vType of
   varEmpty: result := 'Empty';
   varNull: result := 'Null';
   varSmallInt: result := 'SmallInt';
   varInteger: result := 'Integer';
   varSingle: result := 'Single';
   varDouble: result := 'Double';
   varCurrency: result := 'Currency';
   varDate: result := 'Date';
   varOleStr: result := 'OleStr';
   varDispatch: result := 'Dispatch';
   varError: result := 'Error';
   varBoolean: result := 'Boolean';
   varVariant: result := 'Variant';
   varUnknown: result := 'Unknown';
   varByte: result := 'Byte';
   varString: result := 'String';
   varTypeMask: result := 'TypeMask';
   varArray: result := 'Array';
   varByRef: result := 'ByRef';
 end; // case
end;