I have a string that stores a number and a unit for example
x= '$120'
y = ' 90 Degrees F'
banana = '200 kgm'
orange = '300 gm'
total_weight = banana + orange/1000
and for example I want to add the weights
total_weight = 200 + 300/1000
Thanks!
I'm trying to extract the numbers only to do some operations with these... any idea of what the simplest way to do this? I'm only dealing with these two formats i.e. digits are at the begining or at the end of the string...
kgmand orange is ingm, surely that means that the weights are200000and300, not200and300, which adds more complexity to the problem. Does that matter to you?. - Gareth Lattyorangeby1000for that exact reason - jamylak