I have looked at various methods ranging from string.erase/ ispunct etc. and I cant simply get it working for my code.
My code is as follows:
ifstream infilei("test.txt")
**Second part of code......**
while ( !infilei.eof() )
{
string wordlist;
infilei >> wordlist;
inputlist.push_back(wordlist);
}
The text.txt contains commas, single quotation, double quotations etc. and I need to remove them.
Where infilei >> wordlist; is shown, I have tried to use a if statement to remove strings with ‘”‘ etc. but it still does not remove single or double quotation. Is there another way or can I set an string.erase for above a certain ascii range? And is the a way to also send string to lower case during push_back?
Thank you
You should write the if statement like so
if(str[i]=='\"' or str[i]=='\'')and as for the lowercase this should do it: