Dan said:
Hello,
I have a need to take user inputted text such as:
13.5*(1./((1./5)-1.))**(1./4.17)
and evaluate to a number. What key words would I google on? Or are
they some decent object oriented books that you know of that cover
this? Online tutorials or sample source?
http://www.csharphelp.com/archives2/archive289.html
The above link will prove most helpful. It includes the source and is
both freely modifiable and distributable. It provides a powerful and
flexible framework with a number of built-in functions and even allows
you to add functions of your own. It also parses any number of
parameters to be fed to user-defined functions and passes them along
when invoking those functions.
The one spot of trouble I had with it was the expression parser. It was
rather flakey when it came to handling characters such as ":", " "
(space) and "_". I believe it was due to the author's use of character
scanning. I rewrote my copy of the code to use Regex.Split. Not only is
the code simpler and easier to modify but it's also much more
predictable. Should the expression parser prove to be a problem for you,
I'll be glad to forward you a copy of what I have.
--
There are 10 kinds of people. Those who understand binary and those who
don't.
http://code.acadx.com
(Pull the pin to reply)