Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - isempty() determine if a string is empty http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 isempty()           Determine if a string is empty
------------------------------------------------------------------------------
 Declaration
   string.hdr

 Syntax
   func logical isempty extern
   param const char cString

 Arguments
   cString is a character string.

 Return
   A logical indicating if the passed string is empty.

 Description
   isempty() returns .t. if the passed parameter string is empty, i. e. it
   only contains spaces, or if it has a length of 0.

   isempty() is functionally equivalent to len( alltrim( cString ) ) == 0.

 Example
   #define EXAMPLE_STRING
   #include example.hdr

   vardef static
      char( 20 ) cString := ""
   enddef
   
   proc Test_isempty
   clear
   // fill a string with a default value if it is empty
   if isempty( cString )
      cString := "USA"
   endif
   ? cString                        // prints USA
   // allow leaving an entry only after something has been entered into
   // a get field
   @ 10, 10 get cString valid .not. isempty( cString )
   read
   ? cString
   endproc

   proc main
   Test_isempty()
   endproc

See Also: len()

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