Microsoft KB Archive/102453

From BetaArchive Wiki

How to Test for a Blank Character Variable

ID: Q102453

The information in this article applies to:

  • Microsoft FoxPro for Windows, versions 2.5x, 2.6, 2.6a
  • Microsoft FoxPro for MS-DOS, versions 1.01, 1.02, 2.0, 2.5x, 2.6, 2.6a
  • Microsoft FoxBASE+ for the Macintosh, version 2.01
  • Microsoft FoxBASE+ for MS-DOS, version 2.1

FoxBASE+

In FoxBASE+, to determine if a character field is blank, use the LEN() function in an IF statement, as follows:

   IF LEN(TRIM(x)) = 0    && where x is the blank memory variable

This function will also return the desired results when executed in all versions of FoxPro.

FoxPro versions 1.02 and Later

In FoxPro version 1.02 and later, the EMPTY() function may be used as follows:

   IF EMPTY(x)       && where x is still the blank memory variable

NOTE: The EMPTY() function is available only in FoxPro for MS-DOS versions 1.02 and later and in FoxPro for Windows.

FoxPro versions 2.6 and Later

In FoxPro version 2.6 and later, the ISBLANK() function may be used instead.

For information about the ISBLANK() function, refer to the FoxPro Help file or the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q99095
   TITLE     : ISBLANK() Function Provides Additional Null Value
               Support

Additional reference words: FoxDos FoxWin 2.x 2.00 2.10 2.50 2.50a 2.50b nothing field variable foxbase+/mac KBCategory: kbenv kbprg KBSubcategory: FxenvMemory


Last Reviewed: June 27, 1995
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.