Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IsNumeric - VFP analogue?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00307922
Message ID:
00307967
Vues:
35
George,
>>
>>IsDigit() checks only first symbol, so it's not suitable for my situation. Type() works fine.
>>
>>Example:
>>
>>myNumber='12345'
>>type(myNumber)='N'
>>isDigit(myNumber)=.t.
>>
>>myNumber='1hffhhf'
>>type(myNumber)='U'
>>isdigit(myNumber)=.t.
>
>Nadya,
>
>This behavior is not in accordance with the docs. Whether or not it's a bug, I don't know. The TYPE() function, according to the documentation, should receive a character expression, not a variable. If this behavior is a bug, in may be corrected in a future service pack or release. If this does happen, it may cause problems for you in the future.

You think, it's a bug? May be. Ok, I can use your function and call it IsNumeric :) I think about such function from the beginning.
But is it a real bug here? Or it's a secret sense of MS? :) Give us more power, that in doc's and hide it... :)


>While ISDIGIT() does only check the first character in a multi character string, there's nothing to keep you from looping through and using it to check each character via SUBSTR() like this:
>llisnumber = .T.
>lni = 1
>DO WHILE llisnumber AND (lni <= LEN(mystring))
>  llisnumber = ISDIGIT(SUBSTR(mystring, lni, 1))
>  lni = lni + 1
>ENDDO
>RETURN llisnumber
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform