Jump to content

boolean expersion

- - - - -

  • Please log in to reply
2 replies to this topic

#1
jaiii

jaiii

    Learning Programmer

  • Members
  • PipPipPip
  • 45 posts
Hi,

I need convert Ansistring to boolean

for example:

int a=5;
AnsiString S="a < 5";

How can I convert S to boolean

OR

can I evaluate S as boolean in runtime ?

Thankx veri much.

Edited by Jaan, 20 April 2010 - 02:57 AM.
Please use code tags when you are posting your codes!


#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
You'll need to create a parser. For my money, it's a little easier in C++ than C, but either will work. Making a parser is non-trivial, however.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
jaiii

jaiii

    Learning Programmer

  • Members
  • PipPipPip
  • 45 posts
Thankx for reply by I search simple way:

TBooleanField *BF=new TBooleanField(this);
int a=5;
Ansistring S="a > 10";
bool b;
BF->AsString=S;
b=bf=value;
B=false;




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users