btpoole
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2015
06:08 PM
RETAIN 00 AFTER DECIMAL
I am trying to join a set of numbers that is where one is a integer and the other comes from a string. I am not sure of how to get it to work. I have the integer for example 12, I wish to join 00 directly after the 2. As you might guess I get type mismatch. I have tried couple of ways but either the 00 are not added or I get type mismatch. My latest effort shown here:
number=12
whole= str(1.00)
whole=mid(whole,3,2)
total= number + whole
Hoping total would be 1200
Any help or advice appreciated
Thanks
number=12
whole= str(1.00)
whole=mid(whole,3,2)
total= number + whole
Hoping total would be 1200
Any help or advice appreciated
Thanks
2 REPLIES 2
destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2015
06:30 PM
Re: RETAIN 00 AFTER DECIMAL
If your number is 12, and it is an integer, and you are trying to print it as a string, why not convert it to a string and then do a simple string operation on it before display?
ie
ie
number=12
total=number.tostr()+"00"
' or ".00" to show two decimal places
Print total
btpoole
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2015
06:37 PM
Re: RETAIN 00 AFTER DECIMAL
Thanks that was the operation I was looking for. I think I was trying to make the 00 into an integer.