I have a math expression stored as a String:
String math = "12+3=15";
I want to separate the string into the following:
- int num1 (The first number, 12)
- int num2 (The second number, 3)
- String operator (+)
- int answer (The answer, 15)
(num1 and num2 can be digits between 0-20, and operator can be either +,-,*,/)
What is the easiest way to achieve this? I was thinking about regular expressions, but I'm not sure how to do it.