Expert Software Company : News

miercuri, 12 mai 2010

(VFP) How to check if variable is Integer

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.

lnValue = 1.000
* Is Variable integer?
? NOT ( SET("Point") $ PADL(lnValue,20) )

&& Is whole number?
? (lnValue % 1) = 0

* How many digits after decimal point?
? -AT(SET("Point"), PADL(m.lnNumber,20)) % 20

Niciun comentariu:

Trimiteți un comentariu