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

怎甘沉沦 提交于 2019-12-09 15:35:31

问题


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!


回答1:


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.




回答2:


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

Edit - New location on Github.




回答3:


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.



来源:https://stackoverflow.com/questions/5279744/library-to-parse-a-string-as-a-formula-that-works-with-windows-phone-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!