The following code was produced by a consultant working for my group. I'm not a C++ developer (worked in many languages, though) but would like some independent opinions on the following code. This is in Visual Studio C++ 6.0. I've got a gut reaction (not a good one, obviously), but I'd like some "gut reactions" from seasoned (or even not so unseasoned) C++ developers out there. Thanks in advance!
// Example call
strColHeader = insert_escape(strColHeader, ',', '\\'); //Get rid of the commas and make it an escape character
...snip...
CString insert_escape ( CString originalString, char charFind, char charInsert ) {
bool continueLoop = true;
int currentInd = 0;
do {
int occurenceInd = originalString.Find(charFind, currentInd);
if(occurenceInd>0) {
originalString.Insert(occurenceInd, charInsert);
currentInd = occurenceInd + 2;
}
else {
continueLoop = false;
}
} while(continueLoop);
return(originalString);
}