string Juick encloseHTML string ostr string str string size_type for o

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
string Juick::encloseHTML(string ostr) {
string str;
string::size_type i;
for(i=0; i<ostr.size(); i++) {
if(ostr[i]=='&') str+="&amp;";
else if(ostr[i]=='<') str+="&lt;";
else if(ostr[i]=='>') str+="&gt;";
else str+=ostr[i];
}
return str;
}