Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By JosAH

Thread: Calculate formula which is in a String

  1. #1
    apple987123 is offline Member
    Join Date
    Nov 2012
    Rep Power

    Default Calculate formula which is in a String

    Hello People
    I was wondering if it is Possible to somehow get the result of a calculation I have in a String?
    For example at the end of my Code I get a String which contains


    And as a result I want to get... well the result of that calculation. (In this example "9")

    Now do I have to split every single character out and calculate it like this? Or is there a more efficient way?
    Of course the Formula could be different every time.

    Thanks for your help and time

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power

    Default Re: Calculate formula which is in a String

    I wrote a blog once for this forum that explains and implements a simple expression compiler and interpreter; (see the link on the right side of this reply).

    kind regards,

    apple987123 likes this.
    The only person who got everything done by Friday was Robinson Crusoe.

Similar Threads

  1. Formula class
    By imorio in forum New To Java
    Replies: 3
    Last Post: 02-23-2011, 10:38 PM
  2. changing TF formula
    By o.imen in forum Lucene
    Replies: 0
    Last Post: 09-16-2010, 01:20 PM
  3. Formula Builder
    By rbs100 in forum Advanced Java
    Replies: 1
    Last Post: 07-03-2009, 06:57 PM
  4. create a formula from a string
    By lemon3 in forum New To Java
    Replies: 4
    Last Post: 07-18-2008, 09:24 PM
  5. What is the formula?
    By yuchuang in forum New To Java
    Replies: 3
    Last Post: 04-30-2007, 10:00 PM

Posting Permissions

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