FUNCTIONS CT

Nul()

Return an empty string, whatever the argument

Syntax

Signature
Nul( [xValue] ) --> cNull

Arguments

xValue

Any value, usually the result of a function that is called only for what it does.

Return value

Always "".

Description

Nul() hides the result of a function inside a string expression, for example "Press a key: " + Nul( Inkey( 0 ) ).

Notes

The result is a string, so it can not be compared with or added to a number.

Nul() is not Empty(): Empty( xValue ) tests a value and gives .T. or .F.; Nul( xValue ) drops the value and always gives "".

Example

Nul_.prg
PROCEDURE Main()

   Check( 'Nul( 5 )                         ', Nul( 5 ), "" )
   Check( 'Nul() without an argument        ', Nul(), "" )
   Check( '"Done" + Nul( Date() )           ', "Done" + Nul( Date() ), "Done" )

RETURN

STATIC PROCEDURE Check( cTitle, xResult, xExpected )

   QOut( cTitle + IIF( xResult == xExpected, "OK", "ERROR" ) )

RETURN
nu

Output

Nul( 5 )                         OK
Nul() without an argument        OK
"Done" + Nul( Date() )           OK

See also