Results 1 to 4 of 4
  1. #1
    Googol is offline Member
    Join Date
    Aug 2012
    Posts
    11
    Rep Power
    0

    Default Convert string operation symbols "+", "-", "/", "*" etc.

    What is the easiest way to convert a string expression to something I can solve? I have never used association lists but could that work? Or maybe the replaceAll() function?

    For clarification I'm trying to solve functions such as "3 + 4", or [ "3", "+", "4"].

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,005
    Blog Entries
    7
    Rep Power
    20

    Default Re: Convert string operation symbols "+", "-", "/", "*" etc.

    I once wrote a blog article for this forum: the article develops a compiler for infix expressions and shows you a way how to parse and interpret/evaluate those expressions. The blog article contains all the code. If I'm not mistaken there's a link to my blobs on the right side of this reply.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default Re: Convert string operation symbols "+", "-", "/", "*" etc.

    Quote Originally Posted by JosAH View Post
    If I'm not mistaken there's a link to my blobs on the right side of this reply.
    Surely "blogs"?
    I'm not sure showing off your blobs on a public forum is entirely legal...
    Please do not ask for code as refusal often offends.

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,005
    Blog Entries
    7
    Rep Power
    20

    Default Re: Convert string operation symbols "+", "-", "/", "*" etc.

    Quote Originally Posted by Tolls View Post
    Surely "blogs"?
    I'm not sure showing off your blobs on a public forum is entirely legal...
    What's wrong with my blobs? The'yre fine blobs and fully functional; and don't you stare at my blobs!

    kind regards,

    Jos ;-)
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Replies: 1
    Last Post: 02-01-2012, 08:37 PM
  2. Replies: 2
    Last Post: 10-08-2009, 11:28 PM
  3. Replies: 2
    Last Post: 01-24-2009, 06:56 PM
  4. Replies: 1
    Last Post: 10-20-2008, 07:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •