Returning the var type based on content of object
- Posted by znorq2 May 13, 2009
- 862 views
Hi,
I created the following function;
------------------------------------------------------------------------------------------------ global function fVarType(object oObject) -->> cGA08, uGA08 ------------------------------------------------------------------------------------------------ -->> Purpose: Return A, N, F or E depending on the oObject content; -->> 'A'tom -->> 'N'ested sequence (Array) -->> 'F'lat sequence (May be considered as a string) -->> 'E'mpty sequence -->> ========================================================================================= -->> GA08; Created. -->> ========================================================================================= -- atom xType -- xType = 'F' -- if atom(oObject) then return 'A' end if if equal(oObject, "") then return 'E' end if -- for cnt = 1 to length(oObject) do if sequence(oObject[cnt]) then xType = 'N' exit end if end for -- return xType -- end function
Can someone please verify if this is an efficient way to do it - or can I speed this up?
Kenneth / ZNorQ