Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
PADL() weird translation
Message
From
01/03/2003 03:53:49
 
 
To
01/03/2003 02:39:10
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00759865
Message ID:
00759876
Views:
18
>>
>>lnNumero=1
>>? PADL(lnNumero,6,'0')   && Returns 000001
>>
>>lnNumero=1.00
>>? PADL(lnNumero,6,'0')   && Returns 001.00
>>
>>
>>Your lnNumero is not integer. So...
>>
>>
>>lnNumero=INT(lnNumero)
>>? PADL(lnNumero,6,'0')   && Returns 000001
>>
>
>lnNumero was calculated by something like VAL('1'), for example. So, yes, that gives 1.00. But, I wonder why this has worked for years without having to apply the INT() approach. Thanks for the info, I'll try to clarify that later on.

I'm not sure whether this apply to your case or not. But afaik, VAL() always return floating point if you have set fixed on or set decimals to > 0. So you have to set both, set fixed off and set decimals to 0 before val(), to return an integer value.

Other way, strtran(str(lnNumero, 6), ' ', '0') always return integer value, no matter what the setting is.

HTH
Herman
Previous
Reply
Map
View

Click here to load this message in the networking platform