Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- RLIB 3.0a Reference - <b>function:</b> typec() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function:    TYPEC()

Purpose:     Test if a PUBLIC/PRIVATE is character type and not blank.

Syntax:      TYPEC( "memvar" )

Arguments:   memvar      - The name of the PUBLIC or PRIVATE variable to
                           test.  The variable name must be passed to
                           TYPEC() as a string and therefore must be
                           enclosed in single or double quotes.

Returns:     True if the indicated variable is of character type and is
             not empty (blank or a null string).

Description: This function is very useful if you need to not only verify
             that a variable or argument is of character type but also
             that it is not empty or a null string.  TYPEC() is especially
             useful in user-defined functions where parameter verification
             is important.

Notes:       TYPEC() follows the same convention as the Clipper TYPE()
             function.

Example:     PRIVATE blank_var, null_var, char_var, num_var
             blank_var = " "
             null_var  = ""
             char_var  = "Y"
             num_var   = 1

             ? TYPEC("blank_var")            && .F.
             ? TYPEC("null_var")             && .F.
             ? TYPEC("char_var")             && .T.
             ? TYPEC("num_var")              && .F.
             ? MyOpen()                      && .F.
             ? MyOpen(" ")                   && .F.
             ? MyOpen("my.dbf")              && .T.

             *------------------------------------------------------------
             * Function: MyOpen()
             * Purpose:  Open a database named with the character filename
             *           parameter after verifying the correct parameter
             *           usage, and that the file exists.
             *------------------------------------------------------------
             FUNCTION MyOpen
             PARAMETER filename
             IF .NOT. TYPEC("filename")
                *-- not only will this verify that the required parameter
                *-- is Character in type, but also that it is not blank.
                BOXASK("No filename given.", 10)
                RETURN .F.
             ENDIF
             USE (filename)
             RETURN .T.

Source:      RL_TYPEC.PRG

See also:    VALTYPEC()

See Also: VALTYPEC()

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