如何评估一个字符串表示的数学表达式? [英] How can I evaluate a math expression represented by a string?
本文介绍了如何评估一个字符串表示的数学表达式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这很容易实现一个计算器解析字符串(例如, 2 ^ 3/2
),并计算操作的结果。但是,有一个库中已经有能力这样做的。
It's easy to implement a "Calculator" to parse a string (e.g., 2 ^ 3 / 2
) and compute the result of operations. But, is there a library already capable of doing this?
推荐答案
的 dotMath 库做到这一点。
这篇关于如何评估一个字符串表示的数学表达式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文