mathematical String Evaluation

Discussion in 'ASP .Net' started by kris Palmby, Jan 24, 2006.

  1. kris Palmby

    kris Palmby Guest

    hi,

    I'm trying to do something which I assume is fairly simple but I jsut cannot
    seem to do it.

    I have a string which i am trying to evaluate Mathematically
    for Example

    Dim strEval as string
    Dim decEval as Decimal

    strEval = "(10+5) * 6"

    I'm trying to get decEval = 90

    Can anyone help me out with this?

    Thanks
    Kris
     
    kris Palmby, Jan 24, 2006
    #1
    1. Advertising

  2. kris Palmby

    Spam Catcher Guest

    "kris Palmby" <> wrote in news:#
    :

    > I have a string which i am trying to evaluate Mathematically
    > for Example
    >
    > Dim strEval as string
    > Dim decEval as Decimal
    >
    > strEval = "(10+5) * 6"
    >
    > I'm trying to get decEval = 90
    >
    > Can anyone help me out with this?


    I don't think .NET has a command to do this... I think you need a 3rd party
    Math Parser to do this (or wirte your own class). Check this thread (and
    google):

    http://groups.google.ca/group/microsoft.public.dotnet.languages.csharp/brow
    se_thread/thread/ffa69c642f9338c3/4dd4571aa1ea677e?
    lnk=st&q=Math+Parser+.NET&rnum=1&hl=en#4dd4571aa1ea677e


    --
    Stan Kee ()

    Boycott StarForce!
    http://www.glop.org/starforce
     
    Spam Catcher, Jan 24, 2006
    #2
    1. Advertising

  3. kris Palmby

    Scott Allen Guest

    You could use JScript's Eval method from VB/C#:
    http://www.odetocode.com/Code/80.aspx

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    On Tue, 24 Jan 2006 16:25:14 +1000, "kris Palmby"
    <> wrote:

    >hi,
    >
    >I'm trying to do something which I assume is fairly simple but I jsut cannot
    >seem to do it.
    >
    >I have a string which i am trying to evaluate Mathematically
    >for Example
    >
    >Dim strEval as string
    >Dim decEval as Decimal
    >
    >strEval = "(10+5) * 6"
    >
    >I'm trying to get decEval = 90
    >
    >Can anyone help me out with this?
    >
    >Thanks
    >Kris
    >
     
    Scott Allen, Jan 24, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Bickett
    Replies:
    3
    Views:
    532
    Paul McGuire
    Oct 20, 2004
  2. John Hunter
    Replies:
    0
    Views:
    373
    John Hunter
    Oct 20, 2004
  3. Ilias Lazaridis
    Replies:
    2
    Views:
    406
    Ilias Lazaridis
    Apr 24, 2005
  4. Ilias Lazaridis
    Replies:
    74
    Views:
    797
    Ilias Lazaridis
    Apr 4, 2005
  5. Ilias Lazaridis
    Replies:
    18
    Views:
    362
    Bill Guindon
    Apr 9, 2005
Loading...

Share This Page