QString Snippets: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
(Cleanup)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
note: This page will contain code snippets of all QString functions
{{LangSwitch}}
Note: This page will contain code snippets of all QString functions.


'''QString::endsWith()'''<br />Returns true if the string ends with s; otherwise returns false.<br /><code><br />#include &lt;QTextStream&amp;gt;<br />#include &lt;QString&amp;gt;
'''QString::endsWith()'''
Returns true if the string ends with s; otherwise returns false.
<code>
#include <QTextStream>
#include <QString>


int main()<br />{<br /> QTextStream out(stdout);<br /> QString *string = new QString(&quot;example-0.0.1.tar.gz&amp;quot;);
int main()
 
{
if (string-&gt;endsWith(&quot;.tar.gz&amp;quot;) == true) {<br /> out &lt;&lt; &quot;True\n&amp;quot;;<br /> } else {<br /> out &lt;&lt; &quot;False\n&amp;quot;;<br /> }<br />}
    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;
}
</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;
}