Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
PADL() weird translation
Message
De
01/03/2003 03:53:49
 
 
À
01/03/2003 02:39:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00759865
Message ID:
00759876
Vues:
25
>>
>>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform