Reputation: 3774
Hi I have create mathematical expression as string format
String strFormula = "((2*(" + a + "+(2*" + st + "))+2*(" + b + "+(2*" + st + ")))*" + l + "/1000000)*" + amount;
strFormula = CommonFunctions.FormatFormulaWithGermanStandard(strFormula);
I want to evaluate this mathematical expression .
Please suggest me usable link or sample code.
Upvotes: 1
Views: 1409
Reputation: 9157
If you don't want to roll your own, JEXL should be able to handle that kind of expression, and it's relatively lightweight.
Upvotes: 0
Reputation: 6115
There are three ways to solve an expression which are by prefix, postfix or infix you can implement or can check java code for one of these methods to solve your expression like here is link below of code for solving an expression using postfix method
http://resume.technoplaza.net/java/postfix-calc.php
by googling you can find more useful links
Upvotes: 0
Reputation: 10098
there are 2 ways you can execute this.
use SQL lite (inbuilt) db to execute a select statement with the expression
use google, make a google request with the expression and it will return a response.
Upvotes: 1