取得数据的类型
在网上搜到的一段代码:
procedure TForm1.ShowBasicVariantType(varVar: Variant); var typeString : string; basicType : Integer; begin // Get the Variant basic type : // this means excluding array or indirection modifiers basicType := VarType(varVar) and VarTypeMask; // Set a string to match the type case basicType of varEmpty : typeString := 'varEmpty'; varNull : typeString := 'varNull'; varSmallInt : typeString := 'varSmallInt'; varInteger : typeString := 'varInteger'; varSingle : typeString := 'varSingle'; varDouble : typeString := 'varDouble'; varCurrency : typeString := 'varCurrency'; varDate : typeString := 'varDate'; varOleStr : typeString := 'varOleStr'; varDispatch : typeString := 'varDispatch'; varError : typeString := 'varError'; varBoolean : typeString := 'varBoolean'; varVariant : typeString := 'varVariant'; varUnknown : typeString := 'varUnknown'; varByte : typeString := 'varByte'; varWord : typeString := 'varWord'; varLongWord : typeString := 'varLongWord'; varInt64 : typeString := 'varInt64'; varStrArg : typeString := 'varStrArg'; varString : typeString := 'varString'; varAny : typeString := 'varAny'; varTypeMask : typeString := 'varTypeMask'; end; // Show the Variant type ShowMessage('Variant type = '+typeString); end;