Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Testing for numeric char in a string
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00582918
Message ID:
00582929
Views:
26
>FUNCTION NUMINSTR(STRING)
>
>FOR I = 1 To LEN(STRING)
> IF SUBSTR(STRING,I,1) $ "0123456789"
> RETURN .T.
> ENDIF
>NEXT

OR
FUNCTION NumInStr
LPARAMETERS tcString
* Perhaps speed things up a bit
tcString = ALLTRIM(tcString)
llRet = .F.
FOR lnCnt = 1 To LEN(tcString)
  IF ISDIGIT(SUBSTR(tcString,lnCnt,1))
    llRet = .T.
    EXIT
  ENDIF
ENDFOR
RETURN llRet
Previous
Reply
Map
View

Click here to load this message in the networking platform