You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
690 B
30 lines
690 B
12 years ago
|
#include <QDebug>
|
||
|
#include "UBTextTools.h"
|
||
|
|
||
|
QString UBTextTools::cleanHtmlCData(const QString &_html){
|
||
|
|
||
|
QString clean = "";
|
||
|
|
||
|
|
||
|
for(int i = 0; i < _html.length(); i+=1){
|
||
|
if(_html.at(i) != '\0')
|
||
|
clean.append(_html.at(i));
|
||
|
}
|
||
|
return clean;
|
||
|
}
|
||
|
|
||
|
QString UBTextTools::cleanHtml(const QString& _html){
|
||
|
const QString START_TAG = "<!doctype";
|
||
|
const QString END_TAG = "</html";
|
||
|
|
||
|
QString cleanSource = "";
|
||
|
QString simplifiedHtml = _html;
|
||
|
|
||
|
int start = simplifiedHtml.toLower().indexOf(START_TAG);
|
||
|
int end = simplifiedHtml.toLower().indexOf(END_TAG) + END_TAG.size();
|
||
|
|
||
|
cleanSource = simplifiedHtml.mid(start, end);
|
||
|
|
||
|
return cleanSource;
|
||
|
}
|