Find a number from a string
Hey guys I need ur expertise.. I'm new to Java and been assigned a homework to solve for two equations and get the value of x and y:
something like that. The user would input the equations in a TextField.
So when I convert the getText() from the textfield to a string, how do I extract the numbers (say 2 from 2x or 3 from 3y) to use it to solve the equation? I tried using charAt but then the problem is when the user inputs x+3y=5then it wouldnt work anymore, or becomes more complicated. Im thinking that indexOf might help, but I dont really understand how it works, so please, any assistance would really help.