I'm trying to specifically detect an "x" which is "5", amount of digits in a string, and then convert and assign that value into another string.
And I'm not even sure if I should convert it into a string, so here's another question. Can "unsigned short" types be compared to integers? Or does it have to be strings.
If Moschops is right in his translation of your prompt...
Do a while loop that scrolls through the string until a char is between '0' and '9'. Mark it as your start variable. then continue scrolling through until a char is not between '0' and '9' and make that your end variable. Exit the loop.
Finally, run myNumberStr = bigString.substr(start, end - start);
The end - start portion is because the second argument is expecting a length of the sub-string, not a position value...
If you're clever about the function and the loop, you could set up the loop's begin value to be an input argument for the function which would allow for finding the next set of numbers in that same string the next time through.
I'm once again a little confused what your asking about in the second part of your prompt. Could you show an example of what you're trying to do?
The functions stoi() and to_string() found here might be what you're looking for-> http://www.cplusplus.com/reference/string/