Is it possible to solve a math expression given in a String?

Hi all,  If i'm having the following String: ‘(8+6+4+2+10)/5’, then how would I be able to solve this expression.  It is not possible to parse this expression to decimal ofcourse, so what would be a good way to solve this? Best to use a java action for this or is there another solution?  
1 answers

IOP easiest is to use the javascript eval function

//The eval() function evaluates JavaScript code represented as a string.

console.log(eval('2 + 2'));
// expected output: 4


If you want to do this in java you can use the built in javascript engine see this answer on Stackoverflow:

Hope this helps,