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> valtypec() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function:    VALTYPEC()

Purpose:     Test if a LOCAL/STATIC is character type and not blank.

Syntax:      VALTYPEC( memvar )

Arguments:   memvar      - The STATIC or LOCAL memory variable to test.
                           As with all Clipper 5.0 Static and Local
                           variables, do not enclose the variable name in
                           quotes as with the TYPEC() function.

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.  VALTYPEC() is
             especially useful in user-defined functions where parameter
             verification is important.

Notes:       Pass the LOCAL or STATIC variable directly to VALTYPEC() just
             as you would to VALTYPE().  Do not enclose the variable name
             in quotes, as in the syntax for TYPEC().  Doing so will
             allays yield a false return value since STATIC and LOCAL
             variables are not known by name at run time.

             VALTYPEC() is specific to the Clipper 5.0 version of RLIB and
             does not exist in the Summer '87 version of RLIB.LIB.

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

             ? VALTYPEC(blank_var)            // .F.
             ? VALTYPEC(null_var)             // .F.
             ? VALTYPEC(char_var)             // .T.
             ? VALTYPEC(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 file exists.
             *------------------------------------------------------------
             FUNCTION MyOpen ( filename )
             IF .NOT. VALTYPEC(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_VALTY.PRG

See also:    TYPEC()

See Also: TYPEC()

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