potrebujem v C++ urobit nieco v style htmlspecialchars,
urobil som teda nieco taketo
Kód: Vybrať všetko
string htmlspecialchars (string str) {
string replaceString[] = {"&","<",">",""","'"
};
string searchString[] = {"&","<",">","\"","'"
};
for(int j = 0; j < 5; j++) {
string::size_type pos = 0;
while ( (pos = str.find(searchString[j], pos)) != string::npos ) {
str.replace( pos, searchString[j].size(), replaceString[j] );
pos++;
}
}
return str;
}problem ale je ze ked mam retazec a v nom (") bez lomitka (\") tak ho nenahradi, nemate nejake navrhy ako by sa to dalo vyriesit? diki