如何计算包含表达式的字符串 [英] How to evaluate string containing expression
本文介绍了如何计算包含表达式的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在每个循环中,我的字符串包含以下不同的值
"25 + 5 + 1 + 0"
"5000 * 31/31"
"ROUND(155000,2)"
"IIF(Y =``Y'',155000 * 12/100,)"
At every loop round my string contains different values as follows
"25+5+1+0"
"5000*31/31"
"ROUND(155000,2)"
"IIF ( Y= ''Y'',155000*12/100,)"
how to evaluate(solve) and get answer in some variable or directly insert the answer in database.
推荐答案
尝试 ^ ]解决您的问题.
另请参阅以下链接:
在C#中使用表达式树构建表达式评估器–改进API [ ^ ]
微小的表达评估器 [
Try Runtime C# Expression Evaluator[^] to solve your problem.
Refer these links also:
Building Expression Evaluator with Expression Trees in C# – Improving the API[^]
A Tiny Expression Evaluator[^]
--Amit
这篇关于如何计算包含表达式的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文