tags:

views:

136

answers:

2

What is the best way to do calculations on values in a string, for example: "(3.25 * 4) / 1.25 + 10"

+7  A: 

You need to write math formula parser. If you don't want to write your own, check out this one

http://www.codeproject.com/KB/cs/MathParserLibrary.aspx

Sorantis
A: 

Converting from infix to postfix notation is one way of solving this problem, as you can use a stack to parse and compute the expression.

There are a dozen solutions available online. Here's one of them.

Charlie Salts