Originally Posted by
JackDurden
How would I delete one char from a string?
string aWord = "question?";
while(aWord[i])
{
if(isalpha(aWord[i]))printf ("character %c is alphabetic\n",aWord[i]);
else
delete[i]aWord;
i++;
}
Use the replace function from string:
http://www.cplusplus.com/reference/s...g/replace.html
string aWord = "abcdef";
aWord.replace (3, 1, "");
aWord now contains "abcef";
Edit: Or just use erase:
Has the same effect.
Last edited by VernonDozier; Dec 2nd, 2008 at 3:45 pm.