My code dynamically generates string/number operations. The program dynamically builds something similar to the following:
"My name " + "is " + "G-Man"
"Your age is " + "21"
"5" * "5"
I want to output this:
My Name is G-Man
Your age is 21
25
I can write a library for this, but I currently am under time constraints. If anyone aware of a library that can perform equations similar to above (int + int = int), (string + int = string), etc.?
I think you probably just want to use JavaScript’s built in EVAL function.
EDIT Wow I got 2 down-votes at almost robotic speed when I answered this question ~weird, but again EVAL is probably what you want.
EDIT 2 Here’s a starting point for doing some quick validation of the input to make sure nothing naughty gets Eval’d.