Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Format a field to not show trailing Zeros in decimals.
Message
From
04/08/2000 10:20:18
Tom Gahagan
Alliance Computer Solutions
Thomaston, Georgia, United States
 
 
To
04/08/2000 05:54:41
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00400906
Message ID:
00401035
Views:
16
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform