I am going to have to parse a polynomial string to break it down into its different elements.

Lets say I have this polynomial: 5x^3+-23x^12

What my thoughts were was to do something like this as an example:

Code:string polyString = "5x^3+-23x^12"; char thisChar; for( int count = 0; count < polyString.size(); count++ ){ thisChar = polyString.at(count); //then some if statements in here to detect if it is a number }

I am curious if anyone has a good solution getting the numbers out of the polynomial. All I need to get out is the coefficient and exponent.

My idea is to take the each char and detect what it is, but I was wondering if anyone had a good way of doing this that did not involve if statements that would be incredibly long.