MrBliz
MrBliz

Reputation: 5908

Library to Parse a string as a formula, that works with Windows Phone 7

Are there any .NET libraries out there that will parse a string as a formula?

ie; "if the user inputs "(2 +5) * 2", the library will be able to work out the calculation?

Edit:Preferably something that will work with Windows Phone 7 without too much fiddling would be nice!

Upvotes: 9

Views: 4770

Answers (3)

Reed Copsey
Reed Copsey

Reputation: 564433

NCalc is a fairly nice library that will parse mathematical expressions in .NET code.

Edit - New location on Github.

Upvotes: 13

Den
Den

Reputation: 16826

Due to possible complexities, I would recommend starting with a web API - WolframAlpha recently opened theirs and it works great. As a side effect, your application will have to be constantly connected to an active network.

Upvotes: 0

Jonathan Wood
Jonathan Wood

Reputation: 67223

I posted source code for one that supports expressions, variables and functions.

You can see it at http://www.blackbeltcoder.com/Articles/algorithms/a-c-expression-evaluator.

Upvotes: 5

Related Questions