MCPcopy Create free account
hub / github.com/KDE/kdevelop / htmlToPlainText

Function htmlToPlainText

kdevplatform/util/kdevstringhandler.cpp:105–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105QString htmlToPlainText(const QString& s, HtmlToPlainTextMode mode)
106{
107 switch (mode) {
108 case FastMode: {
109 static const QRegularExpression htmlTagRegex(QStringLiteral("<[^>]+>"));
110 QString result(s);
111 result.remove(htmlTagRegex);
112 return result;
113 }
114 case CompleteMode: {
115 QTextDocument doc;
116 doc.setHtml(s);
117 return doc.toPlainText();
118 }
119 }
120 return QString(); // never reached
121}
122
123QByteArray escapeJavaScriptString(const QByteArray& str)
124{

Callers 4

testHtmlToPlainTextMethod · 0.85
testCommentsMethod · 0.85
contextMenuExtensionMethod · 0.85
contextMenuEventMethod · 0.85

Calls 3

setHtmlMethod · 0.80
QStringClass · 0.70
removeMethod · 0.45

Tested by 2

testHtmlToPlainTextMethod · 0.68
testCommentsMethod · 0.68