Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Check if a character expression is all digits
Message
From
05/09/2003 13:03:26
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00826497
Message ID:
00826507
Views:
23
You can write your own UDF for that like this one:
FUNCTION DigitAll()
    LPARAMETERS tlcExpression

    LOCAL lnCounter, llDigit

    llDigit = .T.
    
    FOR lnCounter = 1 to LEN(tlcExpression)
        IF !ISDIGIT(SUBSTR(tlcExpression, lnCounter, 1))
             llDigit = .F.
        ENDIF
    ENDFOR

    RETURN llDigit
ENDFUNC
You can also add to this function a check for decimal point.



>I need to check if a whole character expression contains nothing but numeric digits. I thought the isdigit() function would do it but I found out that it just checks the leftmost character. Is there any function like isdigit() that checks the whole expression?
>
>Thank you
Previous
Reply
Map
View

Click here to load this message in the networking platform