Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Currency to Character string without rounding?
Message
De
21/07/2000 07:50:53
 
 
À
21/07/2000 07:45:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00395230
Message ID:
00395309
Vues:
13
>>>Dumb question... I looked in help but couldn't find (it's too late a night!) how to convert a currency field to a character string, without it rounding up! A currency field (bucks) containing 399.75 becomes "400" if I STR(bucks) or STR(MTON(bucks)), I just want a string containing "399.75". What am I missing?
>>
>>If you use STR(), you need to specify the two optional parameters that specify the size and decimal precision of the resulting character string; the default is to return just the integer portions.
>>
>>Try STR(bucks,10,2) to get back a 10 character string with two decimals to the right of the decimal point. Note: you will get back ".00" this way when taking the STR() of an integer value.
>
>If you are using VFP 6.0 try Transform( bucks )

It's a currency data type - TRANSFORM() will prefix it with the currency symbol, and will create the number of decimals in the return string as specified with the current SET DECIMALS value. STR() has far better control of string length and the number of decimals unless this behavior fits the application requirements.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform