Results 1 to 2 of 2
- 11-28-2012, 10:08 AM #1
Member
- Join Date
- Nov 2012
- Posts
- 1
- Rep Power
- 0
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
"(3*2)+3"
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
apple987123
- 11-28-2012, 10:19 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,397
- Blog Entries
- 7
- Rep Power
- 17
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,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
Similar Threads
-
Formula class
By imorio in forum New To JavaReplies: 3Last Post: 02-23-2011, 09:38 PM -
changing TF formula
By o.imen in forum LuceneReplies: 0Last Post: 09-16-2010, 01:20 PM -
Formula Builder
By rbs100 in forum Advanced JavaReplies: 1Last Post: 07-03-2009, 06:57 PM -
create a formula from a string
By lemon3 in forum New To JavaReplies: 4Last Post: 07-18-2008, 09:24 PM -
What is the formula?
By yuchuang in forum New To JavaReplies: 3Last Post: 04-30-2007, 10:00 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks