从文本框转换表达与数学表达式在后面的代码 [英] Convert Expression from a Textbox to Math Expression in Code Behind

查看:161
本文介绍了从文本框转换表达与数学表达式在后面的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
我需要一个快速运行表达式解析器

我如何让它当在 X * Y ^ Z 有人类型在我的网页上的文本框来计算代码,公式背后并得到结果?

How do I make it that when someone types in x*y^z in a textbox on my page to calculate that equation in the code behind and get the result?

推荐答案

与此库的 http://www.codeproject.com/Articles/21137/Inside-the-Mathematical-Expressions-Evaluator

我最后代码

Calculator Cal = new Calculator();
txt_LambdaNoot.Text = (Cal.Evaluate(txt_C.Text) / fo).ToString();

现在,当某一个类型的3 * 10 ^ 11,他将得到3000亿

now when some one type 3*10^11 he will get 300000000000

这篇关于从文本框转换表达与数学表达式在后面的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆