Expresion Evaluation
-
Hi, I want to eveluate this string to be value how to do this?? dim str as string str = "10 + 20 + (iif(20>30,40,50)) + 50" the str returns the same but i want to evaluate as a value ... Thanks in Advance Regards, sekannak....
kannak
i am using c#: int complexsum = 10 + 20 + ((20 > 30)? 40: 50) + 50; string str = complexsum.ToString();
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]
-
Hi, I want to eveluate this string to be value how to do this?? dim str as string str = "10 + 20 + (iif(20>30,40,50)) + 50" the str returns the same but i want to evaluate as a value ... Thanks in Advance Regards, sekannak....
kannak
Hi, You cant evaluate an expression like this directly in .Net. You have to create your own function using some algorithm like Polish Notation to evaluate arithmetic expressions. I have submitted an article for this just follow this link... this is very poor explanation but this code will help you alot (I think)... :-O Evaluate Arithmetic Expression using Polish Notation Login in VB.NET 2005[^]
Be an Eagle, Sky is Yours.
-
Hi, You cant evaluate an expression like this directly in .Net. You have to create your own function using some algorithm like Polish Notation to evaluate arithmetic expressions. I have submitted an article for this just follow this link... this is very poor explanation but this code will help you alot (I think)... :-O Evaluate Arithmetic Expression using Polish Notation Login in VB.NET 2005[^]
Be an Eagle, Sky is Yours.
suresh suthar wrote:
You cant evaluate an expression like this directly in .Net.
i have worked on that and wrote the answer.. That is called as single line if statement....
suresh suthar wrote:
this is very poor explanation but this code will help you alot (I think)...
the explanation given is clear
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]
-
i am using c#: int complexsum = 10 + 20 + ((20 > 30)? 40: 50) + 50; string str = complexsum.ToString();
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]
hi, i cannot convert string to int, dim strExt as string strExt = 10 + 20 + (iif(20 > 30), 40, 50) + 50 int complexsum = strExt string str = complexsum.ToString(); its giving convertion error i tried to convert also... Note : This "10 + 20 + (iif(20 > 30), 40, 50) + 50" Expression is comming from database , so i copid to string then am trying to eveluate. Even like Round, abs also will come from database all the expression are evaluates and giving values except IIF....so how to resolve this.. plz...let me know regards, kannak....
kannak
-
hi, i cannot convert string to int, dim strExt as string strExt = 10 + 20 + (iif(20 > 30), 40, 50) + 50 int complexsum = strExt string str = complexsum.ToString(); its giving convertion error i tried to convert also... Note : This "10 + 20 + (iif(20 > 30), 40, 50) + 50" Expression is comming from database , so i copid to string then am trying to eveluate. Even like Round, abs also will come from database all the expression are evaluates and giving values except IIF....so how to resolve this.. plz...let me know regards, kannak....
kannak
sekannak wrote:
i cannot convert string to int, dim strExt as string strExt = 10 + 20 + (iif(20 > 30), 40, 50) + 50 int complexsum = strExt string str = complexsum.ToString();
delcare as, dim strExt as interger
sekannak wrote:
(iif(20 > 30), 40, 50)
cant able to understand what is
iif
, i think it isif
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]
-
Hi, I want to eveluate this string to be value how to do this?? dim str as string str = "10 + 20 + (iif(20>30,40,50)) + 50" the str returns the same but i want to evaluate as a value ... Thanks in Advance Regards, sekannak....
kannak
-
suresh suthar wrote:
You cant evaluate an expression like this directly in .Net.
i have worked on that and wrote the answer.. That is called as single line if statement....
suresh suthar wrote:
this is very poor explanation but this code will help you alot (I think)...
the explanation given is clear
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]
padmanabhan N wrote:
suresh suthar wrote: this is very poor explanation but this code will help you alot (I think)... the explanation given is clear
i m talking abt my code. which i have posted on cp... btw ur code is so simple dat everyone can understand.... thanx:thumbsup:
Be an Eagle, Sky is Yours.