First of all, ive been trying to learn c++ for a couple of days ;)
Problem i need to strip http links from string
code:
string replaceAll(string s, string f, string r) {
unsigned int found = s.find(f);
while(found != string::npos) {
s.replace(found, f.length(), r);
found = s.find(f);
}
return s;
}
string stripHTMLTags(string s) {
while(true) {
unsigned int left = s.find('<');
unsigned int right = s.find('>');
if(left==string::npos || right==string::npos)
break;
s = s.erase(left, right - left + 1);
}
s = replaceAll(s, "<", "<");
s = replaceAll(s, ">", ">");
s = replaceAll(s, "&", "&");
s = replaceAll(s, " ", " ");
// Etc...
return s;
}
if i try to change
unsigned int left = s.find('<');
to
unsigned int left = s.find('http:');
i get this error: warning: character constant too long for its type
Which must be due to int contains one byte??