I'd like to know if you can somehow get something like
String test= "3445+100";
double x= test
so I can turn a typed in calculation into a result?
First time asking sorry if I waste your time :/
I'd like to know if you can somehow get something like
String test= "3445+100";
double x= test
so I can turn a typed in calculation into a result?
First time asking sorry if I waste your time :/
String test= "3445+100";
String[] numberArray=test.split("\\+");
int a = Integer.parseInt(numberArray[0]);
int b = Integer.parseInt(numberArray[1]);
int solution=a+b;
You split the String between the operators. Then you cast the Number-Strings to int and you can cast the Operators with a distinction of cases because you can have only +,*,- and /.