CT_COMPLEMENT

 COMPLEMENT()
 Forms the complement value of a data type
------------------------------------------------------------------------------
 Syntax

     COMPLEMENT(<expValue>) --> xComplement

 Argument

     <expValue>[@]  Designates any valid expression of any data type to
     form a complement value.  Complement() only allows a character string to
     be passed by reference.

 Returns

     COMPLEMENT() returns the complement value that corresponds to the same
     data type for <expValue>.

 Description

     COMPLEMENT() returns the respective opposite value of the <expValue>
     parameter.  In contrast to CHARNOT(), which only permits character
     strings, this function permits all data types.  The result is the same
     data type as the parameter.  For example, a date returns a date as a
     result.  It corresponds to the difference between the indicated date and
     12/31/2999.

 Note

     .  COMPLEMENT(COMPLEMENT(<expValue>)) always returns <expValue>
        as output.

 Examples

     .  The complement of a logical value corresponds to the use of
        .NOT.:

        ? COMPLEMENT(.T.)                  // .F.
        ? COMPLEMENT(.F.)                  // .T.

     .  Numeric values change sign:

        ? COMPLEMENT(99)                   // -99.00
        ? COMPLEMENT(0)                    // 0
        ? COMPLEMENT(-99)                  // 99.00
        ? COMPLEMENT(-9.9)                 // 9.90
        ? COMPLEMENT(9.9)                  // -9.9

     .  With strings, the function works like CHARNOT:

        ? COMPLEMENT("123ABCabc")          // "       <157><156>"

     .  The difference between 1/1/1900 and 01/01/3000:

        SET CENTURY ON
        ? COMPLEMENT(CTOD("01/01/00"))     // 12/31/1099

     .  An empty or invalid date gives the same result -- 01/01/3000:

        SET CENTURY ON
        ? COMPLEMENT(CTOD("  /  /  "))     // 01/01/3000
        ? COMPLEMENT(CTOD("77/77/77"))     // 01/01/3000

See Also: Introduction



Tools – Miscellaneous Functions

Introduction Miscellaneous Functions
ALLOFREE()*  Determines the maximum memory size allocation
BLANK()      Creates a blank value for each data type
COMPLEMENT() Forms the complement value of a data type
DATATYPE()*  Determines the data type of a variable or UDF
GETTIC()     Determines the number of timer ticks
KBDDISABLE() Locks/unlocks the keyboard
KBDEMULATE() Inserts characters into BIOS keyboard buffer to emulate input
KBDSPEED()   Sets keyboard auto repeat speed
KBDSTAT()    Tests for key shift state status, such as Ctrl and Shift
KBDTYPE()    Determines the type of keyboard in use
KEYSEC()     Triggers a key trap after a time delay
KEYTIME()    Triggers a key trap at a specific clock time
MILLISEC()   Time delay in milliseconds
NUL()        Converts the value returned by a function into a null string
SCANKEY()    Queries scan code of keyboard input
SETTIC()     Increases number of time ticks
SHOWKEY()    Continuously displays the INSERT and LOCK status
SOUND()      Creates tones (melodies) by designating frequency and duration
SPEED()      A comparison value used to determine the processor speed
STACKFREE()  Determines the remaining stack space
TOOLVER()    Queries the version number of the Clipper Tools in use
XTOC()       Converts an expression of any data type into a string