View Full Version : Converting a string equation (including operators) to the numeric result
ghell
10-04-2004, 08:32 PM
for example i want to convert "3*3+1" (string) to 10 (number)
it seems like there should be a simple way to do it but i cant work out how :confused:
Roy Sinclair
10-04-2004, 10:49 PM
I think that maybe this is a case where I'd use server side javascript and the dreaded "eval". Back it up with client side javascript which is called first (as long as it's available) and you would have a comprehesive solution.
glenngv
10-05-2004, 03:24 AM
VBScript also has its own Eval (http://www.devguru.com/Technologies/vbscript/quickref/eval.html) function. But we need more details of the problem to know if Eval is indeed necessary.
ghell
10-05-2004, 08:45 AM
thanks ill try that later, how many details could you need though... its a string of a simple equation inclusinf operators.. and i need the result of that
if Eval("3*3+1") will show up as 10 then it will work, i cant really try it from college atm :p
ghell
10-05-2004, 09:33 AM
:D a little tinkering with an old fso notepad clone type thing and i got it working.. and it worked :D
thanks for the help u2 :)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.