Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Showing percentage sign in variable
Message
De
15/08/2005 10:37:55
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01040979
Message ID:
01040990
Vues:
12
>I would like to append the % sign to a variable. My syntax reads:
>
>
>store cmscomp.percent+val("%") to lccomplist
>
>
>But this comes out like 90.00 instead of reading 90.0%
>
>How can I achieve this?

val() converts a text to number. "%" is not a valid number, so it is csonverted to zero. Also, whatever "%" converts to (in this case zero) is added as a number: 90 + 0 = 90.

To combine different texts, you use the same "+" sign, but with data of type character. In this case, convert "percent" to string, with transform() or str().
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform