C#实现字符串计算

借用DataTable的Compute函数进行计算。

string formula = "1+1*4/3+23*(1+2)";
DataTable dt = new DataTable();
string really_data = dt.Compute(formula, "false").ToString();

 

posted @ 2018-10-25 08:40  HandsomeBoy  阅读(1332)  评论(0编辑  收藏  举报