Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing a dollar amount to a string?
Message
From
30/09/1999 15:02:21
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00271203
Message ID:
00271262
Views:
26
>>>>>>>my_amt = 12.45
>>>>>>>my_amt = str(my_amt)
>>>>>>>
>>>>>>>When I change my dollar amount of 12.45 to a string, I loose the
>>>>>>>decimal point values. When I do a (?my_amt) it shows the 12
>>>>>>>and I loose the .45.. Could someone tell me what happend to the
>>>>>>>deciaml values?
>>>>>>
>>>>>>Hi Robert,
>>>>>>
>>>>>>In VFP 6.0, use:
>>>>>>? TRANSFORM(my_amt)
>>>>>>* Or
>>>>>>? TRANSFORM(my_amt, "@$")
>>>>>--------
>>>>>Hi George - nice to hear from you again..
>>>>>What I need to do is take a number (12.45) and
>>>>>strip out the "." to make 1245, then show the implied
>>>>>deciaml place. When I am finished, it should look like...
>>>>>000012450 - this would be float data type of 6.3 - thanks
>>>>
>>>>Hi Rob,
>>>>
>>>>Nice to hear from you too.
>>>
>>>Whoops, make that--
>>>
lcstring = TRANSFORM(my_amt)
>>>lcstring = CHRTRAN(lcstring, ".", "")
>>>lcstring = PADL(lcstring, 8, "0")
>>>lcstring = PADR(lcstring, 9, "0")
Duh!
>>---- thanks... the PADR does not work. I can not get the
>>"0"'s to go were there are blanks..
>
>Hi Rob,
>
>The reason is there are spaces. Better is this:
lcstring = STR(my_amt, 10, 3)
>lcstring = CHRTRAN(ALLTRIM(lcstring), ".", "")
>lcstring = PADL(lcstring, 9, "0")
>I never can remember about those parameters for the STR() function< g >.
---
Hi George:
Thanks - that works!! - You will have to excuse me for asking these
simple questions...I have been brain dead for 30 years now..
Thanks everybody...:)
Robert Keith
Independent Developer
San Antonio, Texas
E-mail address:
rebelrob1@yahoo.com
Previous
Reply
Map
View

Click here to load this message in the networking platform