Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Clipper Tools One Guide - <b>datatype()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
DATATYPE()

Syntax:     DATATYPE(<expX>)

Arguments:  <expX> can be any valid expression.

Returns:    A numeric value.
            Corresponds to the data type of <expX>.

Usage:      DATATYPE() is similar to the Clipper TYPE(),
            although it returns information in the form of numerical
            values.  The bits in the result correspond to specific data
            types.  It is possible to have two bits set simultaneously, and
            it is relatively simple to detect data types with the ISBIT()
            function.

            Bit       Value       Data type
            ---       -----       ---------
             0          0         Undefined
             1          1         Character string
             2          2         Numeric
             3          4         Logic
             4          8         Date
             5         16         Alias
             6         32         Pointer
             1&7       65         Memo field
             8        128         Word
             10       512         Array

            Pointer occurs in combinations with the data type concerned,
            e.g., 33 (string pointer).

            DATATYPE() can also return the type of a Clipper Tools One
            function or a user-defined function.  This is not possible
            with TYPE().

Notes:      An invalid <expX> expression will lead to a runtime error.

Library:    CT1.LIB


--------------------------------- Example ------------------------------

Examples:   ? DATATYPE()                        && 0, undefined
            ? DATATYPE("xxx")                   && 1, string
            ? DATATYPE(123)                     && 2, numeric
            ? DATATYPE(DOY())                   && 2, numerical result
            ? DATATYPE(.T.)                     && 4, logic
            ? DATATYPE(3 > 2)                   && 4, logical expression
            ? DATATYPE(EOF())                   && 4, logic result
            ? DATATYPE(DATE())                  && 8, date
            ? DATATYPE(memofld)                 && 65, memo field
            ? DATATYPE(@crlf)                   && 33, reference to string
            ? DATATYPE(array)                   && 544, reference to array
            ? DATATYPE(array[1])                && 2, numerical element
            ? DATATYPE(array[2])                && 1, string element
            ? TYPE("myfunc()")                  && "UI"
            ? DATATYPE("myfunc()")              && The return value of
                                                && the user-defined function
                                                && according to DATATYPE()



Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson