Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Format a field to not show trailing Zeros in decimals.
Message
De
04/08/2000 10:20:18
Tom Gahagan
Alliance Computer Solutions
Thomaston, Georgie, États-Unis
 
 
À
04/08/2000 05:54:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00400906
Message ID:
00401035
Vues:
17
Tim...

I think this will better suit your needs. At least I hope so! :)
set decimals to 10

mtest= 234.123456700 (or what ever number)
mval=alltrim(str(mtest,45,10))

*test for decimal place.....
mdec=occurs('.',mval)

if mdec > 0 && there is a decimal
&& split string into right and left portions
&& include decimal in the left
mleft = substr(mval,1,at('.',mval))
mright=substr(mval,(at('.',mval)+1),10)
&& now that you have the portion to the right of the decimal...test for "0"
if occurs('0',mright) > 0 && extract portion with numbers
mright = substr(mright,1,at('0',mright)-1)
endif
&& put strings back together
mstring = mleft+mright
else && no decimal

mstring=mval

endif

?mstring

Hope this helps you with our problem!
Tom Gahagan
Alliance
Computer Solutions

"Music, like sex, is much too important to be left to professionals."
Robert Shaw
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform