更新时间:2023-11-28 23:25:40
您正在寻找的是算术评估函数.
在SO处查看此问题和答案; http://***.com/questions/4173623/mathematical-expression-string- to-number-in-java [ ^ ]
有很多关于此的文章,如果您只是四处搜索,也可以使用库.
What you are looking for is Arithmetic Evaluation functions.
See this question and answers over at SO; http://***.com/questions/4173623/mathematical-expression-string-to-number-in-java[^]
There are various articles for this and also libraries you could use if you just search around.
看看这篇很棒的CodeProject文章:
通过在运行时编译C#代码来评估数学表达式 [使用muParser解析数学表达式 [ http://muparser.sourceforge.net/ [ ^ ]
Have a look at this great CodeProject article:
Evaluating Mathematical Expressions by Compiling C# Code at Runtime[^]
or this library:
Parsing Mathematical Expressions with muParser[^]
http://muparser.sourceforge.net/[^]