IsAlpha(), IsDigit(), IsLower(), IsUpper()
These functions all tell you about the state of a character. ISALPHA() returns .T. if the character is alphabetic while ISDIGIT() returns .T. if it's a numeric digit. ISLOWER() and ISUPPER() check the case of a character and return .F. if it's the wrong case or not alphabetic.
Usage |
lIsItAlphabetic = ISALPHA( cString ) lIsItADigit = ISDIGIT( cString ) lIsItLower = ISLOWER( cString ) lIsItUpper = ISUPPER( cString ) |
?ISDIGIT("1abc")returns .T., as does:
?ISUPPER("Smith")Use these functions in parsing and in validating user input. For example, you might check all the characters of a supposedly numeric string before applying VAL() to it. However, if you need all uppercase or all lowercase letters for an operation, it's easier to just apply UPPER() or LOWER().Note that Windows and its ANSI font standard has a different interpretation of which characters constitute the alphabet from DOS and its ASCII basis. ISALPHA() is true for many of the high-order characters (like �, �, and �), which Windows/ANSI maps to non-English alphabets, while FoxPro/DOS reported .F. for anything other than A through Z, uppercase and lowercase.
Example |
? ISALPHA("\WINWORD") && returns .F. ? ISDIGIT("Age 7") && returns .F. ? ISLOWER("lower case") && returns .T. ? ISUPPER("\WINWORD") && returns .F. |
See Also |