Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 471
MrBliz Avatar asked Mar 12 '11 00:03

MrBliz


2 Answers

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

Edit - New location on Github.

like image 121
Reed Copsey Avatar answered Sep 23 '22 06:09

Reed Copsey


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.

like image 41
Jonathan Wood Avatar answered Sep 25 '22 06:09

Jonathan Wood