I am working on a C # application in which I want to evaluate an arithmetic expression that is given as a string. So how did I get the line:
string myExpr="4*(80+(5/2))+2";
And I want to calculate the result of an arithmetic expression. Although in a language such as Javascript, PHP, etc., you could just use Eval to do the trick, which doesn't seem to be an option in C #.
I believe that you can write code to divide it into countless simple expressions, calculate them and add them together, but it will take quite a while and I will probably have a lot of problems in my attempt to do this.
So ... my question is: is there a "simple" way to do this?
source
share