Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Expresion Evaluation

Expresion Evaluation

Scheduled Pinned Locked Moved ASP.NET
tutorialquestion
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sekannak
    wrote on last edited by
    #1

    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

    P S L 3 Replies Last reply
    0
    • S sekannak

      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

      P Offline
      P Offline
      padmanabhan N
      wrote on last edited by
      #2

      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[^]

      S 1 Reply Last reply
      0
      • S sekannak

        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

        S Offline
        S Offline
        Suresh Suthar
        wrote on last edited by
        #3

        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.

        P 1 Reply Last reply
        0
        • S Suresh Suthar

          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.

          P Offline
          P Offline
          padmanabhan N
          wrote on last edited by
          #4

          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[^]

          S 1 Reply Last reply
          0
          • P padmanabhan N

            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[^]

            S Offline
            S Offline
            sekannak
            wrote on last edited by
            #5

            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

            P 1 Reply Last reply
            0
            • S sekannak

              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

              P Offline
              P Offline
              padmanabhan N
              wrote on last edited by
              #6

              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 is if

              Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

              1 Reply Last reply
              0
              • S sekannak

                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

                L Offline
                L Offline
                logiclabz
                wrote on last edited by
                #7

                Are u looking for evaluate expression in asp.net

                ----------------- logiclabz

                1 Reply Last reply
                0
                • P padmanabhan N

                  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[^]

                  S Offline
                  S Offline
                  Suresh Suthar
                  wrote on last edited by
                  #8

                  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.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups