Valid Routine to Convert Character Data to Lowercase

Last reviewed: April 30, 1996
Article ID: Q111920
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5x, 2.6x
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6x
  • Microsoft FoxPro for Macintosh, version 2.5x, 2.6a

SUMMARY

By using the generic code snippet shown below, you can change input data to all lowercase.

MORE INFORMATION

By using the following generic code snippet, you can change input data to all lowercase. It is very simple to change memory variables, but changing database fields takes more code manipulation. In this example, there is only one database open and any number of variables with different names other than the database's field names. The Screen Generator is also used for this example.

In the SETUP snippet of the screen, type the following code:

   *** Puts all of the database fields into an array called mydata
   =AFIELDS(mydata)

In the VALID snippet of any character field, type the following generic code:

   *** List of Variables and Definitions                 ***
   *** curfield - the current field or memory variable   ***
   *** newval - The new value converted to lowercase     ***
   *** BEGIN CODE HERE                                   ***
   curfield=VARREAD()
   newval=LOWER(EVALUATE(curfield))
   ** IF...ENDIF to determine if it's a field name or memory variable
   IF ASCAN(mydata,curfield)>0
      REPLACE &curfield WITH newval && database field
   ELSE
      STORE newval TO &curfield  && memory variable
   ENDIF
   SHOW GET &curfield  && refreshes only the current GET
   *** END CODE ***


Additional reference words: FoxMac FoxDos FoxWin
2.50 2.50a
2.50b 2.50c 2.60 2.60a Character Convert Lower-case lower case upper
capital letters caps
KBCategory: kbenv kbprg kbcode
KBSubcategory: FxenvMemory


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 30, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.