QString Snippets: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(Add "cleanup" tag)
(Cleanup)
 
Line 1: Line 1:
{{Cleanup | reason=Auto-imported from ExpressionEngine.}}
{{LangSwitch}}
 
Note: This page will contain code snippets of all QString functions.
note: This page will contain code snippets of all QString functions


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

Latest revision as of 22:18, 28 June 2015

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;
}