You are looking for an algorithm that's called a "recursive descent parser".
Doing this type of thing is an exercise that we had to do in programming
classes 35 years ago.
I'm a little bit amazed that something like this doesn't exist in the .Net
framework. Even in VBScript I think there's the "eval" function that might
have limited parsing capability. Still ... this is a good programming
exercise to learn how to write recursive functions.
If you want to create your own class function to do this go get a
fundamental programming book and study the chapters on recursion. I'd be
real surprised if you couldn't find a good writeup on how to do this.
-bwr-
"Pitaridis Aristotelis" <pi*******@hotmail.comwrote in message
news:47***********************@news.sunsite.dk...
Is there a way to make a calculation stored in a string. For example:
Dim A as string = "4 * 10 ^ 8"
Dim Result as Decimal = Calculate(A)