String to float conversation and calculation


#1

HI,
I want calculate the numbers inside the string value . how to convert float and calculate the values.
my string is : 53/(155/100)/(155/100)


#2

@kumarkvinoth

eval(string);
ex: eval(‘53/(155/100)/(155/100)’);


#3

thank you so much. its working fine :grinning:


#4

@kumarkvinoth
glad to help please mark it as a solution…


#5

If this string is coming from the user, eval can be very dangerous. I would strongly advise against using eval, at least until after sanitizing the string, removing anything that is not a number or a calculation symbol.


#7

agreed @kumarkvinoth u can break this string using regex than evaluate.