A quick and dirty solution is to use the JScript engine:
Microsoft.JScript.Vsa.VsaEngine myEngine =
Microsoft.JScript.Vsa.VsaEngine.CreateEngine();
return Microsoft.JScript.Eval.JScriptEvaluate(
"3.3*5.2*5", myEngine
);
See also
http://www.odetocode.com/Code/80.aspx for a similar
technique.
--
Scott
On Mon, 5 Jul 2004 12:45:17 -0400, "VM" <vo******@yahoo.com> wrote:
If I have a string variable with a formula:
string sMyformula = "3.3*5.2*5";
How can I convert this to a mathematical formula that the compiler can
calculate? For all purposes, the formula in the string will always be valid.
Thanks
--
Scott
http://www.OdeToCode.com