473,386 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 3192
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Christos TZOTZIOY Georgiou | last post by:
Hi all, this post contains at the end a handy module that I've used quite often when I wanted to analyse the occasional complex expression and how it was to be evaluated. The function...
0
by: Vanish92 | last post by:
I created a dll to evaluate a home-grown data type. I added an entry in the autoexp.dat pointing to my dll for the data type. When I try to debug it (_Debug compile), I have the expression...
1
by: Faraz | last post by:
Hi everyone, I am developing a WinForms application and I need a Math Expression validator, not an expression evaluator. So I want to be able to say... if ((sales - tax) > 20) THEN (x * y *...
0
by: Faraz | last post by:
Hi everyone, I am developing a WinForms application and I need a Math Expression validator, not an expression evaluator. So I want to be able to say... if ((sales - tax) > 20) THEN (x * y *...
2
by: Faraz | last post by:
Thanks Dave, To repeat the question: I am developing a WinForms application and I need a Math Expression validator, not an expression evaluator. So I want to be able to say... if ((sales - tax)...
1
by: Brian Gideon | last post by:
All, I'm looking for an expression evaluator to use in .NET and I was hoping someone could point me to a free library. Google's not playing nice on this one. I wrote my own, but if there is...
0
by: palani12kumar | last post by:
I had some problem regarding creating an expression evaluator using C. i've have not got an clear idea about the "expression Evaluator". Can you please tell me, what's an expression evaluator? and...
4
by: =?Utf-8?B?RXJpY2E=?= | last post by:
I am trying to dynamically create a javascript link. But, I get the following error: BC32017: Comma, ')', or a valid expression continuation expected. Here is the line I try creating the...
1
by: Monusonu | last post by:
Hi Expert, I am trying to get the value from excel formula cell using POI. My code works fine for less complex formula cells, but fails or returns error code for complex formula cells. Following...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.