Hi,
I'm relatively new to C++. I'm trying to search for a double quote and replace it with 2 double quotes ( for CSV format conversion). The code compiles and works fine when Quote is any string. But it freezes when I try to search for a "\"".
Help appreciated.
string Quote="\"";//Maybe I initialize this wrong?
string text="I'm "trying" to search for quotes";
void SearchforQuote()
{
size_t found=0;
string doublequote="\"\"";
for(int i=0;i<text.size();i++)
{
while ((found = text.find(Quote,found)) !=string::npos)
{
text.replace(found,Quote.length(),doublequote);
found += doublequote.length();
}
found=0;//I'm reading from a file and have multiple lines.
}
}