Convert Variable to decimal XBASE

136 Views Asked by At

Have a variable containing a value like '000000017733'. - Need to convert it to '000000177,33' - Then make a sum with other variable. - Then convert it again to a string that will look like (for example) '000000008921'

XBASE

any one can help?

something like: **variables VGCA = 77,33 TOT = '000000017733'

** convert TOT to 177,33

** do the needed operation FINALV = TOT - VCGA

** reconvert FINALV from 100,00 to 000000010000

1

There are 1 best solutions below

0
stolen_leaves On

Don't know if you still need this or not, but in python 3 the code would look like this -

vgca = 77.33
tot = '000000017733'
tot_float = float(tot)/100
print(tot_float)
finalv = tot_float - vgca
finalv *= 100
finalv_string = format("%012d"%finalv)
print(finalv_string)

the output is -

177.33
000000010000