posted 17 years ago
I am writing a collection of mathematical analysis programs and would like to allow the user to input a valid Java math expression which could then be interpreted by the program as new code. I realize that this may have security issues but the programs are only for my personal use. A snippet below shows what I'm trying to do. A user input of e.g. "x*x" would result in the output of 25 i.e. 5 squared. In Perl I was able to do this quite easily via eval($input).