The vartype function under the variants unit can obtain the variable type, but it returns only a number. You need to combine these constants defined in the System Unit:
Varempty = $0000; varnull = $0001; varsmallint = $0002; varinteger = $0003; varsingle = $0004; vardouble = $0005; varcurrency = $0006; vardate = $0007; varolestr = $0008; vardispatch = $0009; varerror = $ 000a; varboolean = $ 000b; varvariant = $ 000c; varunknown = $ 000d; var1_int = $0010; varbyte = $0011; varword = $0012; varlongword = $0013; varint64 = $0014; varstrarg = $0048; varstring = $0100; varany = $0101; vartypemask = $ 0fff; vararray = $2000; varbyref = $4000;
Functions and tests are as follows:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs; Type tform1 = Class (tform) Procedure formcreate (Sender: tobject); end; vaR form1: tform1; implementation {$ R *. DFM} {function} function getvartype (const V: variant): string; begin case vartype (V) 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 '; varshortint: Result: = 'unknown int'; varbyte: Result: = 'byte'; varword: Result: = 'word'; varlongword: Result: = 'longword'; varint64: Result: = 'int64'; varstrarg: Result: = 'strarg '; varstring: Result: = 'string'; varany: Result: = 'any'; vartypemask: Result: = 'typemask '; vararray: Result: = 'array'; varbyref: Result: = 'byref'; end; {test} procedure tform1.formcreate (Sender: tobject); var I: integer; W: word; s: string; D: Double; begin showmessage (getvartype (I )); {INTEGER} showmessage (getvartype (w); {word} showmessage (getvartype (s); {string} showmessage (getvartype (d); {double} end; end.
Here is something similar: http://www.cnblogs.com/del/archive/2008/05/09/1158858.html#1190739