Forum Discussion

btpoole's avatar
btpoole
Channel Surfer
10 years ago

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

2 Replies

  • destruk's avatar
    destruk
    Streaming Star
    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

    number=12
    total=number.tostr()+"00"
    ' or ".00" to show two decimal places
    Print total
  • btpoole's avatar
    btpoole
    Channel Surfer
    Thanks that was the operation I was looking for. I think I was trying to make the 00 into an integer.