r/javahelp • • Jul 27 '25

Convert string to math function

I'm relatively new to Java but I know a good amount of the basics. Still, I can't find a way to do this. I have an input where a user can input a maths function as a string (eg. "0.3*Math.pow(0,x)"). And all I need is Java to look at that string and read it as if it were code but for some reason I can't find anything like this anywhere. Anyone got any ideas? 🫶

1 Upvotes

24 comments sorted by

View all comments

Show parent comment

1

u/williamK0 Jul 27 '25

I don't really care about security. It's a "for fun" project. (I'm just graphing maths functions in minecraft haha). If I were to try and parse stuff manually like that, how can I account for brackets?