Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Testing a Character field for Numeric Data'
Message
From
03/08/2009 12:23:42
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01415119
Message ID:
01415901
Views:
68
>>
>>LEN(CHRTRAN(ALLTRIM(myField),"0123456789.+-","") = 0 ;
>>AND OCCURS(".",myField) < 2 ;
>>AND AT("-",myField) < 2 ;
>>AND AT("+",myField) < 2
>>
>
>which wouldn't take care of the order by allowing ".-444+4" as a valid number.


No. ".-444+4" would be flagged as invalid, since AT("-",myField) < 2 = .f. Same for AT("+",myField) < 2


BTW, there is a paren missing; the code should read:
LEN(CHRTRAN(ALLTRIM(myField),"0123456789.+-","")) = 0 ;
AND OCCURS(".",myField) < 2 ;
AND AT("-",myField) < 2 ;
AND AT("+",myField) < 2
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform