Skip to content

Commit

Permalink
Simplification of the previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Dueñas committed Jan 3, 2014
1 parent db07c2a commit 29ce846
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/songinfo/ultimatelyricsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,18 +321,15 @@ QString UltimateLyricsProvider::NoSpace(const QString& text) {
// tells whether a html block has alphanumeric characters (skipping tags)
// TODO: handle special characters (e.g. ® á)
bool UltimateLyricsProvider::HTMLHasAlphaNumeric(const QString& html) {
bool has_alphanumeric = false;
for (int i = 0; i < html.size(); )
if (html[i] == QChar('<')) {
while (i < html.size() and html[i] != QChar('>'))
i ++;
} else {
if (isalnum(html[i].toAscii())) {
has_alphanumeric = true;
break;
}
i ++;
}

return has_alphanumeric;
bool in_tag = false;
foreach (const QChar& c, html) {
if (!in_tag and c.isLetterOrNumber())
return true;
else if (c == QChar('<'))
in_tag = true;
else if (c == QChar('>'))
in_tag = false;
}
qLog(Debug) << html;
return false;
}

0 comments on commit 29ce846

Please sign in to comment.