RD

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 )
Although you can pass an entire character string to these functions, they only look at the first character, so:

?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

Lower(), Upper()


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net