String Evaluation?

BlitzPlus Forums/BlitzPlus Programming/String Evaluation?

Splatman(Posted 2003) [#1]
Is there a way to evaluate a string and return a number? I found a set of functions that worked apart from when I used Sine and it complains about no value in front of the operater, it qas know that you can not use negative numbers unless you use 0-2 instead of -2. I am trying to make a graphing program for drawing graphs of equations like y=4x+5 and y=sin(x), but I need to let the user type in a equation, I can replace the value for x fine it is just evalulating the string I end up with. Any sugestions?


Russell(Posted 2003) [#2]
Got this from the code archives section:
http://www.blitzbasic.com/codearcs/codearcs.php?code=124

This function doesn't convert the whole user-typed function for you, but individual user-typed 'numbers' should be no problem. Maybe someone has written an 'Eval()' function which is usually used for that purpose. Much more complex than Val(), though.

Hope this helps! (Not sure why, even after 3 different versions of Blitz, we still don't have a Val() function :/)

Russell


RexRhino(Posted 2003) [#3]
oops, never mind.