QString Snippets

From Qt Wiki
Revision as of 06:54, 24 February 2015 by Maintenance script (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

note: This page will contain code snippets of all QString functions

QString::endsWith()
Returns true if the string ends with s; otherwise returns false.

#include <QTextStream&gt;
#include <QString&gt;

int main()
{
QTextStream out(stdout);
QString *string = new QString("example-0.0.1.tar.gz&quot;);

if (string->endsWith(".tar.gz&quot;) == true) {
out << "True\n&quot;;
} else {
out << "False\n&quot;;
}
}