How to check if variable is Integer

Tagged:

FoxPro doesn't provide a direct way to check if variable is integer or how many digits it has after decimal point but it can be accomplished using PADL() function.

This is sample code. Add error handling and adjust to your requirements as necessary.

lnValue = 1.000
&& Is Variable integer?
? NOT ( SET("Point") $ PADL(lnValue,20) )
 
&& How many digits after decimal point?
? -AT(SET("Point"), PADL(m.lnNumber,20)) % 20