extracting int from a string

How would I extract an int from a string with no spaces.
for example

int main()
string x = "helloworld557";
string y = "mynameistimmy4234";


whats the easiest way?
also I want to modify the string after the ints are out to be
x= "helloworld"
y= "mynameistimmy"

I'd also suggest the boost lexical_cast<> www.boost.org
If every input has format "textnumber" and if the compiler supports C++11 sufficiently, then std::regex_match can split the string just fine.
Topic archived. No new replies allowed.