Microsoft KB Archive/111920

{| = Valid Routine to Convert Character Data to Lowercase =
 * width="100%"|

ID: Q111920

2.5x 2.6x | 2.00 2.5x 2.6x | 2.5x 2.60a

WINDOWS  | MS-DOS         | MACINTOSH 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: KBSubcategory: FxenvMemory Keywords         : kbcode FxenvMemory Version          : 2.5x 2.6x | 2.00 2.5x 2.6x | 2.5 Platform         : MACINTOSH MS-DOS WINDOWS
 * }