you could avoid all of that (and maintain operator priority) by splitting the string on the operators and solving the equations in the desired order