Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Testing a Character field for Numeric Data'
Message
De
30/07/2009 17:53:52
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Divers
Thread ID:
01415119
Message ID:
01415578
Vues:
64
>> but this doesn't work every time. e.g. when luValue = '08'
>
>You could remove leading zeros:
>
>lcValue = Alltrim("    0000800.00  ")
>If not " " $ m.lcValue
>  lcValue = Chrtran(Ltrim(Chrtran(m.lcValue,"0"," "))," ","0")
>EndIf
>? m.lcvalue 
>
>TYPE(), EVALUATE(), etc. all have the disadvantage of executing VFP code. If I'd by called to a security review of your application, one thing I'd try is to enter
>
>execscript('ZAP')
>
>into the text field. If you use TYPE(), you can see that the table is ZAPped, because the code is executed. It's your decision, though. ;-)

Hence this suggestion, that doesn't use TYPE() or EVALUATE():
LEN(CHRTRAN(ALLTRIM(myField),"0123456789.+-","") = 0 ;
AND OCCURS(".",myField) < 2 ;
AND AT("-",myField) < 2 ;
AND AT("+",myField) < 2
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform