Information générale
Catégorie:
Codage, syntaxe et commandes
Alex--
When I've faced similar situations in the past, I've done something like this...
IF NOT IsDgtStr(cVal2Check)
*--something's not kosher with this number
ENDIF
***********************************************************************
* Title....: IsDgtStr.Prg
* Description: Evaluate a string to see if it has any embedded characters that * are not digits.
PROCEDURE IsDgtStr
***********************************************************************
LPARAMETER tcStr
LOCAL tnLen, tlReturn, ni
tcStr = ALLTRIM(tcStr)
tnLen = LEN(tcStr)
tlReturn = .T.
FOR ni = 1 to LEN(ALLTRIM(tcStr))
tcChar = SUBSTR(tcStr,ni)
IF NOT ISDIGIT(tcChar)
tlReturn = .F.
EXIT
ENDIF
ENDFOR
RETURN tlReturn
*: eof
--Greg
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement