Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Padding with zeroes
Message
De
18/09/1998 11:25:12
 
 
À
18/09/1998 10:16:36
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00137666
Message ID:
00138233
Vues:
12
>>>>>You can try this in lostfocus
*lostfocus
>>>>>this.value = substr(this.value,1,1)+;
>>>>>        padl(val(substr(this.value,2)),5,"0")
Inputmask would be something like "A99999" and format "!".
>>>
>>>>Change lostfocus code to :
this.value = substr(this.value,1,1)+;
>>>>        padl(substr(trim(this.value),2),5,"0")
>>
>>TRANSFORM("@L 999999",XXX) pads XXX representation with zeroes; I would try to use that instead of PADL().

>Federico,
>You can use many routines for conversion. However here transform() doesn't seem to be a shorter (or faster - if ever a lostfocus like this one needs optimizing) coding to me. Maybe I could see why it's better if you provide full code.

I just prefer using TRANSFORM(); since FP gives us a way to pad numbers with zeroes automatically, I don't like (want) my programmers to reinvent the wheel or use (possibly) more obscure methods. My code would be
This.Value = LEFT(This.Value,1)+TRANSF("@L 99999", VAL(SUBSTR(THIS.VALUE,2))
I think I read somewhere that in FP there are at least three ways to do anything; I (let's emphasize that "I") just prefer the least involved way.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform