QString Snippets

From Qt Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

En Ar Bg De El Es Fa Fi Fr Hi Hu It Ja Kn Ko Ms Nl Pl Pt Ru Sq Th Tr Uk Zh

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>
#include <QString>

int main()
{
    QTextStream out(stdout);
    QString* string = new QString("example-0.0.1.tar.gz");
    if (string->endsWith(".tar.gz") == true) {
        out << "True\n";
    } else {
        out << "False\n";
    }
    return 0;
}