Can't erase digits from c++ string by using the 'erase' function : <p>Using c++ 14.
I'm prompting the user for a string containing both letters and integers, and trying to "strip" the integers from the string itself via the string.erase() function.</p>

<p>The problem i'm facing is when there are 2 or more sequential numbers, than the function seems to erase the first but delete the latter.</p>

<p><strong>Example:</strong></p>

<pre><code>   input: H23ey Th2e3re St01ack O34verflow
   output: H3ey There St1ack O4verflow
</code></pre>

<p>I can do it another way by using a new string, looping through the existing one and adding only what isalpha or isspace, but it seems messier.</p>

<p><strong>code:</strong></p>

<pre><code>string digalpha {};
cout &lt;&lt; "Enter string containing both numbers and letters: ";
getline(cin, digalpha);


for (size_t i {}; i &lt; digalpha.size(); i++)
    if (isdigit(digalpha.at(i)))
        digalpha.erase(i,1);


cout &lt;&lt; digalpha &lt;&lt; endl;

cout &lt;&lt; endl;
return 0;
</code></pre>
