Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Testing a Character field for Numeric Data'
Message
From
28/07/2009 14:16:59
 
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:
01415128
Views:
64
>>Hi All:
>>
>>Do you have an easy way for testing if a character field contains valid numeric data.
>>
>>Someone suggested:
>>
>>
>>IF TRANSFORM(VAL(m.luValue)) == m.luValue
>>
>>
>>but this doesn't work every time. e.g. when luValue = '08'
>>
>>Thanks,
>>
>>Yossi
>
>Type(myTable.MyField) = 'N'

Thanks, it seems to work.

So then the VFP help file is wrong (gasp!) when it says in the entry on TYPE():

"VARTYPE( ) is similar to the TYPE( ) function, but VARTYPE( ) is faster and does not require quotation marks ("") to enclose the specified expression."

Consider:
x = '0.8'
? TYPE(x)   &&returns "N"
? VARTYPE(x)   &&returns "C"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform