469,898 Members | 1,563 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

Boolean Expression Evaluator

Hi,

I have an application which is reading a boolean expression from an
external file into a string. The string will equal something like "1 =
1" or "0 = 1". I need to be able to evaluate the boolean answer, but
have found that using command such as IIF, CBOOL, etc, will not accept
the string datatype. There seem to be lots of maths expression
evaluation tools and examples, but my need seems very simple and I'm
wondering if there is an easier way? If I could use something simple
such as IIF(<string>,<true>,<false>) it would be ideal

Thanks for your help
Aug 5 '08 #1
2 2999
Here is an article on making one in C#. You could do the same from VB.NET.
http://www.codeproject.com/KB/dotnet/Expr.aspx

Here is another. So it appears you can cheat by using JScript's eval method:
http://www.odetocode.com/Code/80.aspx

"Workaholic" <wo**********@hotmail.comwrote in message
news:8d**********************************@2g2000hs n.googlegroups.com...
Hi,

I have an application which is reading a boolean expression from an
external file into a string. The string will equal something like "1 =
1" or "0 = 1". I need to be able to evaluate the boolean answer, but
have found that using command such as IIF, CBOOL, etc, will not accept
the string datatype. There seem to be lots of maths expression
evaluation tools and examples, but my need seems very simple and I'm
wondering if there is an easier way? If I could use something simple
such as IIF(<string>,<true>,<false>) it would be ideal

Thanks for your help

Aug 5 '08 #2
Thanks for this reply sstory. I looked at the example you suggested at
http://www.odetocode.com/Code/80.aspx, and successfully converted this
to VB with some help from this site http://labs.developerfusion.co.uk/co...arp-to-vb.aspx

The code now successfully resolves "1>2" to false, or "1<2" to true,
but errors on "1=1". I will add a post on the OdeToCode site to see if
somebody can help

Thanks again
Aug 6 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Christos TZOTZIOY Georgiou | last post: by
1 post views Thread by Brian Gideon | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.