Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Removing leading zeros
Message
De
08/06/1999 10:37:48
 
 
À
08/06/1999 09:03:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00227388
Message ID:
00227431
Vues:
26
>when I try to take the val(c_id) it won't allow me to select anything in my combobox(shows the names but won't let me select). If I tru allt(val(c_id) i get an error.

You need to make the value a string again before doing the ALLTRIM(): ALLTRIM(STR(VAL(c_id)))
Beware that if you do this in a SELECT statement, you should make sure that the result string is long enough to contain the largest number, or you may get truncated values. If so, you could use PADR(ALLTRIM(STR(VAL(c_id))), MAX_LEN) to get a left aligned value, or STR(VAL(c_id), MAX_LEN) to get a right aligned value (MAX_LEN beeing the field size or the length of the longest number).
If speed is important, you should experiment with TRANSFORM(...) instead of ALLTRIM(STR(...)) and LEFT(TRANSFORM(...) + lcString_With_MAX_LEN_Spaces, MAX_LEN) instead of PADR(...) to find out what is fastest.

Arne
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform