View Single Post
Old 20th November 2016, 02:44   #8
jaromanda
Forum King
 
Join Date: Jun 2007
Location: Under the bridge
Posts: 2,289
I went at the problem a little differently

code:
std::string::size_type ix;
std::string::size_type ixEquals;
std::string str( line);

/* delete everything after the first # */
ix = str.find('#');
if (ix != str.npos) {
if (ix == 0) {
// '#' in first position, use old logic
str.erase( ix);
}
else {
ixEquals = str.find('=');
if (ixEquals != str.npos) {
if (ix < ixEquals) {
// '#' before '=', use old logic
str.erase( ix);
}
else {
// when '#' is after '=' MUST be preceded by a space to be considered a comment
ix = str.find(" #");
if (ix != str.npos && ix > ixEquals) {
str.erase(ix);
}
}
}
else {
// no '=' so back to old logic
str.erase( ix);
}
}
}


Is it just me or are shoutcast users getting dumber?
jaromanda is offline   Reply With Quote