TVarType
Identifies the type of value stored within a Variant, TVarType is used in the VarType function.
The keyword value returned aligns to the type of variable queried.
A declared but unused variant variable, returns the value of zero (0).
Declaration: TVarType = word
An example of the use of this enumeration follows, using a variable called avocado.
//Where the variable AVOCADO has been set to be of type VARIANT, as below
//var avocado : variant;
avocado := null;
//VARIANT set to NULL
LogInfo(
'Variable set as NULL = '
+IntToStr(VarType(avocado)));
//Result is 1
avocado :=
'Sooty and Sweep'
;
//VARIANT set as a string
LogInfo(
'Variable set as STRING = '
+IntToStr(VarType(avocado)));
//Result 256
avocado :=
7
;
//VARIANT set as integer
LogInfo(
'Variable set as INTEGER = '
+IntToStr(VarType(avocado)));
//Result is 3
avocado:=
7.56
;
//VARIANT set with 2 dp
LogInfo(
'Variable set with 2 dp = '
+IntToStr(VarType(avocado)));
//Result is 5
Beth := Date;
//VARIANT set as a DATE
LogInfo(
'Variable set as a DATE = '
+IntToStr(VarType(avocado)));
//Result is 7
A result of 1 shows that the Variant called avocado is null.
A result of 256 shows that the Variant called avocado is a String.
A result of 3 shows that the Variant called avocado is an Integer.
A result of 5 shows that the Variant called avocado is a Double.
A result of 7 shows that the Variant called avocado is a Date.
Keywords (Hex Value; Statelake Value)
varEmpty = $0000; { vt_empty 0 }
varNull = $0001; { vt_null 1 }
varSmallint = $0002; { vt_i2 2 }
varInteger = $0003; { vt_i4 3 }
varSingle = $0004; { vt_r4 4 }
varDouble = $0005; { vt_r8 5 }
varCurrency = $0006; { vt_cy 6 }
varDate = $0007; { vt_date 7 }
varOleStr = $0008; { vt_bstr 8 }
varDispatch = $0009; { vt_dispatch 9 }
varError = $000A; { vt_error 10 }
varBoolean = $000B; { vt_bool 11 }
varVariant = $000C; { vt_variant 12 }
varUnknown = $000D; { vt_unknown 13 }
varShortInt = $0010; { vt_i1 16 }
varByte = $0011; { vt_ui1 17 }
varWord = $0012; { vt_ui2 18 }
varLongWord = $0013; { vt_ui4 19 }
varInt64 = $0014; { vt_i8 20 }