<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qstring.cpp --> <title>QLatin1String Class | Qt Core 5.9</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.9</td><td ><a href="qtcore-index.html">Qt Core</a></td><td ><a href="qtcore-module.html">C++ Classes</a></td><td >QLatin1String</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#related-non-members">Related Non-Members</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QLatin1String Class</h1> <!-- $$$QLatin1String-brief --> <p>The <a href="qlatin1string.html">QLatin1String</a> class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal. <a href="#details">More...</a></p> <!-- @@@QLatin1String --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QLatin1String></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += core</td></tr></table></div><ul> <li><a href="qlatin1string-members.html">List of all members, including inherited members</a></li> </ul> <p><b>Note:</b> All functions in this class are reentrant.</p> <a name="public-functions"></a> <h2 id="public-functions">Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#QLatin1String">QLatin1String</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#QLatin1String-1">QLatin1String</a></b>(const char *<i>str</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#QLatin1String-2">QLatin1String</a></b>(const char *<i>str</i>, int <i>size</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#QLatin1String-3">QLatin1String</a></b>(const QByteArray &<i>str</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QLatin1Char </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#at">at</a></b>(int <i>pos</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const char *</td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#data">data</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const char *</td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#latin1">latin1</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QLatin1String </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#left">left</a></b>(int <i>length</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QLatin1String </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#mid">mid</a></b>(int <i>start</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QLatin1String </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#mid-1">mid</a></b>(int <i>start</i>, int <i>length</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QLatin1String </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#right">right</a></b>(int <i>length</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#size">size</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-not-eq">operator!=</a></b>(const QString &<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-not-eq-1">operator!=</a></b>(const char *<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-not-eq-2">operator!=</a></b>(const QByteArray &<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-lt">operator<</a></b>(const QString &<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-lt-1">operator<</a></b>(const char *<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-lt-2">operator<</a></b>(const QByteArray &<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-lt-eq">operator<=</a></b>(const QString &<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-lt-eq-1">operator<=</a></b>(const char *<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-lt-eq-2">operator<=</a></b>(const QByteArray &<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-eq-eq">operator==</a></b>(const QString &<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-eq-eq-1">operator==</a></b>(const char *<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-eq-eq-2">operator==</a></b>(const QByteArray &<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-gt">operator></a></b>(const QString &<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-gt-1">operator></a></b>(const char *<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-gt-2">operator></a></b>(const QByteArray &<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-gt-eq">operator>=</a></b>(const QString &<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-gt-eq-1">operator>=</a></b>(const char *<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-gt-eq-2">operator>=</a></b>(const QByteArray &<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QLatin1Char </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-5b-5d">operator[]</a></b>(int <i>pos</i>) const</td></tr> </table></div> <a name="related-non-members"></a> <h2 id="related-non-members">Related Non-Members</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-not-eq-3">operator!=</a></b>(QLatin1String <i>s1</i>, QLatin1String <i>s2</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-lt-3">operator<</a></b>(QLatin1String <i>s1</i>, QLatin1String <i>s2</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-lt-eq-3">operator<=</a></b>(QLatin1String <i>s1</i>, QLatin1String <i>s2</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-eq-eq-3">operator==</a></b>(QLatin1String <i>s1</i>, QLatin1String <i>s2</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-gt-3">operator></a></b>(QLatin1String <i>s1</i>, QLatin1String <i>s2</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlatin1string.html#operator-gt-eq-3">operator>=</a></b>(QLatin1String <i>s1</i>, QLatin1String <i>s2</i>)</td></tr> </table></div> <a name="details"></a> <!-- $$$QLatin1String-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qlatin1string.html">QLatin1String</a> class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.</p> <p>Many of <a href="qstring.html">QString</a>'s member functions are overloaded to accept <code>const char *</code> instead of <a href="qstring.html">QString</a>. This includes the copy constructor, the assignment operator, the comparison operators, and various other functions such as <a href="qstring.html#insert">insert()</a>, <a href="qstring.html#replace">replace()</a>, and <a href="qstring.html#indexOf">indexOf()</a>. These functions are usually optimized to avoid constructing a <a href="qstring.html">QString</a> object for the <code>const char *</code> data. For example, assuming <code>str</code> is a <a href="qstring.html">QString</a>,</p> <pre class="cpp"> <span class="keyword">if</span> (str <span class="operator">=</span><span class="operator">=</span> <span class="string">"auto"</span> <span class="operator">|</span><span class="operator">|</span> str <span class="operator">=</span><span class="operator">=</span> <span class="string">"extern"</span> <span class="operator">|</span><span class="operator">|</span> str <span class="operator">=</span><span class="operator">=</span> <span class="string">"static"</span> <span class="operator">|</span><span class="operator">|</span> str <span class="operator">=</span><span class="operator">=</span> <span class="string">"register"</span>) { <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span> } </pre> <p>is much faster than</p> <pre class="cpp"> <span class="keyword">if</span> (str <span class="operator">=</span><span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span>(<span class="string">"auto"</span>) <span class="operator">|</span><span class="operator">|</span> str <span class="operator">=</span><span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span>(<span class="string">"extern"</span>) <span class="operator">|</span><span class="operator">|</span> str <span class="operator">=</span><span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span>(<span class="string">"static"</span>) <span class="operator">|</span><span class="operator">|</span> str <span class="operator">=</span><span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span>(<span class="string">"register"</span>)) { <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span> } </pre> <p>because it doesn't construct four temporary <a href="qstring.html">QString</a> objects and make a deep copy of the character data.</p> <p>Applications that define <code>QT_NO_CAST_FROM_ASCII</code> (as explained in the <a href="qstring.html">QString</a> documentation) don't have access to <a href="qstring.html">QString</a>'s <code>const char *</code> API. To provide an efficient way of specifying constant Latin-1 strings, Qt provides the <a href="qlatin1string.html">QLatin1String</a>, which is just a very thin wrapper around a <code>const char *</code>. Using <a href="qlatin1string.html">QLatin1String</a>, the example code above becomes</p> <pre class="cpp"> <span class="keyword">if</span> (str <span class="operator">=</span><span class="operator">=</span> QLatin1String(<span class="string">"auto"</span>) <span class="operator">|</span><span class="operator">|</span> str <span class="operator">=</span><span class="operator">=</span> QLatin1String(<span class="string">"extern"</span>) <span class="operator">|</span><span class="operator">|</span> str <span class="operator">=</span><span class="operator">=</span> QLatin1String(<span class="string">"static"</span>) <span class="operator">|</span><span class="operator">|</span> str <span class="operator">=</span><span class="operator">=</span> QLatin1String(<span class="string">"register"</span>) { <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span> } </pre> <p>This is a bit longer to type, but it provides exactly the same benefits as the first version of the code, and is faster than converting the Latin-1 strings using <a href="qstring.html#fromLatin1">QString::fromLatin1</a>().</p> <p>Thanks to the <a href="qstring.html">QString</a>(<a href="qlatin1string.html">QLatin1String</a>) constructor, <a href="qlatin1string.html">QLatin1String</a> can be used everywhere a <a href="qstring.html">QString</a> is expected. For example:</p> <pre class="cpp"> <span class="type"><a href="../qtwidgets/qlabel.html">QLabel</a></span> <span class="operator">*</span>label <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="../qtwidgets/qlabel.html">QLabel</a></span>(QLatin1String(<span class="string">"MOD"</span>)<span class="operator">,</span> <span class="keyword">this</span>); </pre> <p><b>Note: </b>If the function you're calling with a <a href="qlatin1string.html">QLatin1String</a> argument isn't actually overloaded to take <a href="qlatin1string.html">QLatin1String</a>, the implicit conversion to <a href="qstring.html">QString</a> will trigger a memory allocation, which is usually what you want to avoid by using <a href="qlatin1string.html">QLatin1String</a> in the first place. In those cases, using <a href="qstring.html#QStringLiteral">QStringLiteral</a> may be the better option.</p></div> <p><b>See also </b><a href="qstring.html">QString</a>, <a href="qlatin1char.html">QLatin1Char</a>, and <a href="qstring.html#QStringLiteral">QStringLiteral</a>.</p> <!-- @@@QLatin1String --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QLatin1String[overload1]$$$QLatin1String --> <h3 class="fn" id="QLatin1String"><a name="QLatin1String"></a>QLatin1String::<span class="name">QLatin1String</span>()</h3> <p>Constructs a <a href="qlatin1string.html">QLatin1String</a> object that stores a nullptr.</p> <p>This function was introduced in Qt 5.6.</p> <!-- @@@QLatin1String --> <!-- $$$QLatin1String$$$QLatin1Stringconstchar* --> <h3 class="fn" id="QLatin1String-1"><a name="QLatin1String-1"></a>QLatin1String::<span class="name">QLatin1String</span>(const <span class="type">char</span> *<i>str</i>)</h3> <p>Constructs a <a href="qlatin1string.html">QLatin1String</a> object that stores <i>str</i>.</p> <p>The string data is <i>not</i> copied. The caller must be able to guarantee that <i>str</i> will not be deleted or modified as long as the <a href="qlatin1string.html">QLatin1String</a> object exists.</p> <p><b>See also </b><a href="qlatin1string.html#latin1">latin1</a>().</p> <!-- @@@QLatin1String --> <!-- $$$QLatin1String$$$QLatin1Stringconstchar*int --> <h3 class="fn" id="QLatin1String-2"><a name="QLatin1String-2"></a>QLatin1String::<span class="name">QLatin1String</span>(const <span class="type">char</span> *<i>str</i>, <span class="type">int</span> <i>size</i>)</h3> <p>Constructs a <a href="qlatin1string.html">QLatin1String</a> object that stores <i>str</i> with <i>size</i>.</p> <p>The string data is <i>not</i> copied. The caller must be able to guarantee that <i>str</i> will not be deleted or modified as long as the <a href="qlatin1string.html">QLatin1String</a> object exists.</p> <p><b>See also </b><a href="qlatin1string.html#latin1">latin1</a>().</p> <!-- @@@QLatin1String --> <!-- $$$QLatin1String$$$QLatin1StringconstQByteArray& --> <h3 class="fn" id="QLatin1String-3"><a name="QLatin1String-3"></a>QLatin1String::<span class="name">QLatin1String</span>(const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &<i>str</i>)</h3> <p>Constructs a <a href="qlatin1string.html">QLatin1String</a> object that stores <i>str</i>.</p> <p>The string data is <i>not</i> copied. The caller must be able to guarantee that <i>str</i> will not be deleted or modified as long as the <a href="qlatin1string.html">QLatin1String</a> object exists.</p> <p><b>See also </b><a href="qlatin1string.html#latin1">latin1</a>().</p> <!-- @@@QLatin1String --> <!-- $$$at[overload1]$$$atint --> <h3 class="fn" id="at"><a name="at"></a><span class="type"><a href="qlatin1char.html">QLatin1Char</a></span> QLatin1String::<span class="name">at</span>(<span class="type">int</span> <i>pos</i>) const</h3> <p>Returns the character at position <i>pos</i> in this object.</p> <p><b>Note: </b>This function performs no error checking. The behavior is undefined when <i>pos</i> < 0 or <i>pos</i> >= <a href="qlatin1string.html#size">size</a>().</p><p>This function was introduced in Qt 5.8.</p> <p><b>See also </b><a href="qlatin1string.html#operator-5b-5d">operator[]</a>().</p> <!-- @@@at --> <!-- $$$data[overload1]$$$data --> <h3 class="fn" id="data"><a name="data"></a>const <span class="type">char</span> *QLatin1String::<span class="name">data</span>() const</h3> <p>Returns the Latin-1 string stored in this object.</p> <!-- @@@data --> <!-- $$$latin1[overload1]$$$latin1 --> <h3 class="fn" id="latin1"><a name="latin1"></a>const <span class="type">char</span> *QLatin1String::<span class="name">latin1</span>() const</h3> <p>Returns the Latin-1 string stored in this object.</p> <!-- @@@latin1 --> <!-- $$$left[overload1]$$$leftint --> <h3 class="fn" id="left"><a name="left"></a><span class="type"><a href="qlatin1string.html#QLatin1String">QLatin1String</a></span> QLatin1String::<span class="name">left</span>(<span class="type">int</span> <i>length</i>) const</h3> <p>Returns the substring of length <i>length</i> starting at position 0 in this object.</p> <p><b>Note: </b>This function performs no error checking. The behavior is undefined when <i>length</i> < 0 or <i>length</i> > <a href="qlatin1string.html#size">size</a>().</p><p>This function was introduced in Qt 5.8.</p> <p><b>See also </b><a href="qlatin1string.html#mid">mid</a>() and <a href="qlatin1string.html#right">right</a>().</p> <!-- @@@left --> <!-- $$$mid[overload1]$$$midint --> <h3 class="fn" id="mid"><a name="mid"></a><span class="type"><a href="qlatin1string.html#QLatin1String">QLatin1String</a></span> QLatin1String::<span class="name">mid</span>(<span class="type">int</span> <i>start</i>) const</h3> <p>Returns the substring starting at position <i>start</i> in this object, and extending to the end of the string.</p> <p><b>Note: </b>This function performs no error checking. The behavior is undefined when <i>start</i> < 0 or <i>start</i> > <a href="qlatin1string.html#size">size</a>().</p><p>This function was introduced in Qt 5.8.</p> <p><b>See also </b><a href="qlatin1string.html#left">left</a>() and <a href="qlatin1string.html#right">right</a>().</p> <!-- @@@mid --> <!-- $$$mid$$$midintint --> <h3 class="fn" id="mid-1"><a name="mid-1"></a><span class="type"><a href="qlatin1string.html#QLatin1String">QLatin1String</a></span> QLatin1String::<span class="name">mid</span>(<span class="type">int</span> <i>start</i>, <span class="type">int</span> <i>length</i>) const</h3> <p>This is an overloaded function.</p> <p>Returns the substring of length <i>length</i> starting at position <i>start</i> in this object.</p> <p><b>Note: </b>This function performs no error checking. The behavior is undefined when <i>start</i> < 0, <i>length</i> < 0, or <i>start</i> + <i>length</i> > <a href="qlatin1string.html#size">size</a>().</p><p>This function was introduced in Qt 5.8.</p> <p><b>See also </b><a href="qlatin1string.html#left">left</a>() and <a href="qlatin1string.html#right">right</a>().</p> <!-- @@@mid --> <!-- $$$right[overload1]$$$rightint --> <h3 class="fn" id="right"><a name="right"></a><span class="type"><a href="qlatin1string.html#QLatin1String">QLatin1String</a></span> QLatin1String::<span class="name">right</span>(<span class="type">int</span> <i>length</i>) const</h3> <p>Returns the substring of length <i>length</i> starting at position <a href="qlatin1string.html#size">size</a>() - <i>length</i> in this object.</p> <p><b>Note: </b>This function performs no error checking. The behavior is undefined when <i>length</i> < 0 or <i>length</i> > <a href="qlatin1string.html#size">size</a>().</p><p>This function was introduced in Qt 5.8.</p> <p><b>See also </b><a href="qlatin1string.html#mid">mid</a>() and <a href="qlatin1string.html#left">left</a>().</p> <!-- @@@right --> <!-- $$$size[overload1]$$$size --> <h3 class="fn" id="size"><a name="size"></a><span class="type">int</span> QLatin1String::<span class="name">size</span>() const</h3> <p>Returns the size of the Latin-1 string stored in this object.</p> <!-- @@@size --> <!-- $$$operator!=[overload1]$$$operator!=constQString& --> <h3 class="fn" id="operator-not-eq"><a name="operator-not-eq"></a><span class="type">bool</span> QLatin1String::<span class="name">operator!=</span>(const <span class="type"><a href="qstring.html">QString</a></span> &<i>other</i>) const</h3> <p>Returns <code>true</code> if this string is not equal to string <i>other</i>; otherwise returns <code>false</code>.</p> <p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>().</p> <!-- @@@operator!= --> <!-- $$$operator!=$$$operator!=constchar* --> <h3 class="fn" id="operator-not-eq-1"><a name="operator-not-eq-1"></a><span class="type">bool</span> QLatin1String::<span class="name">operator!=</span>(const <span class="type">char</span> *<i>other</i>) const</h3> <p>This function overloads <a href="qlatin1string.html#operator-not-eq">operator!=</a>().</p> <p>The <i>other</i> const char pointer is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromUtf8">QString::fromUtf8</a>() function.</p> <p>You can disable this operator by defining <code>QT_NO_CAST_FROM_ASCII</code> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p> <p>This function was introduced in Qt 4.3.</p> <!-- @@@operator!= --> <!-- $$$operator!=$$$operator!=constQByteArray& --> <h3 class="fn" id="operator-not-eq-2"><a name="operator-not-eq-2"></a><span class="type">bool</span> QLatin1String::<span class="name">operator!=</span>(const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &<i>other</i>) const</h3> <p>This function overloads <a href="qlatin1string.html#operator-not-eq">operator!=</a>().</p> <p>The <i>other</i> byte array is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromUtf8">QString::fromUtf8</a>() function.</p> <p>You can disable this operator by defining <code>QT_NO_CAST_FROM_ASCII</code> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p> <p>This function was introduced in Qt 5.0.</p> <!-- @@@operator!= --> <!-- $$$operator<[overload1]$$$operator<constQString& --> <h3 class="fn" id="operator-lt"><a name="operator-lt"></a><span class="type">bool</span> QLatin1String::<span class="name">operator<</span>(const <span class="type"><a href="qstring.html">QString</a></span> &<i>other</i>) const</h3> <p>Returns <code>true</code> if this string is lexically less than the <i>other</i> string; otherwise returns <code>false</code>.</p> <p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings using the <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>() function.</p> <!-- @@@operator< --> <!-- $$$operator<$$$operator<constchar* --> <h3 class="fn" id="operator-lt-1"><a name="operator-lt-1"></a><span class="type">bool</span> QLatin1String::<span class="name">operator<</span>(const <span class="type">char</span> *<i>other</i>) const</h3> <p>This is an overloaded function.</p> <p>The <i>other</i> const char pointer is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromUtf8">QString::fromUtf8</a>() function.</p> <p>You can disable this operator by defining <code>QT_NO_CAST_FROM_ASCII</code> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p> <p>This function was introduced in Qt 4.3.</p> <!-- @@@operator< --> <!-- $$$operator<$$$operator<constQByteArray& --> <h3 class="fn" id="operator-lt-2"><a name="operator-lt-2"></a><span class="type">bool</span> QLatin1String::<span class="name">operator<</span>(const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &<i>other</i>) const</h3> <p>This is an overloaded function.</p> <p>The <i>other</i> const char pointer is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromUtf8">QString::fromUtf8</a>() function.</p> <p>You can disable this operator by defining <code>QT_NO_CAST_FROM_ASCII</code> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p> <p>This function was introduced in Qt 5.0.</p> <!-- @@@operator< --> <!-- $$$operator<=[overload1]$$$operator<=constQString& --> <h3 class="fn" id="operator-lt-eq"><a name="operator-lt-eq"></a><span class="type">bool</span> QLatin1String::<span class="name">operator<=</span>(const <span class="type"><a href="qstring.html">QString</a></span> &<i>other</i>) const</h3> <p>Returns <code>true</code> if this string is lexically less than or equal to string <i>other</i>; otherwise returns <code>false</code>.</p> <p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>().</p> <!-- @@@operator<= --> <!-- $$$operator<=$$$operator<=constchar* --> <h3 class="fn" id="operator-lt-eq-1"><a name="operator-lt-eq-1"></a><span class="type">bool</span> QLatin1String::<span class="name">operator<=</span>(const <span class="type">char</span> *<i>other</i>) const</h3> <p>This is an overloaded function.</p> <p>The <i>other</i> const char pointer is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromUtf8">QString::fromUtf8</a>() function.</p> <p>You can disable this operator by defining <code>QT_NO_CAST_FROM_ASCII</code> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p> <p>This function was introduced in Qt 4.3.</p> <!-- @@@operator<= --> <!-- $$$operator<=$$$operator<=constQByteArray& --> <h3 class="fn" id="operator-lt-eq-2"><a name="operator-lt-eq-2"></a><span class="type">bool</span> QLatin1String::<span class="name">operator<=</span>(const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &<i>other</i>) const</h3> <p>This is an overloaded function.</p> <p>The <i>other</i> array is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromUtf8">QString::fromUtf8</a>() function.</p> <p>You can disable this operator by defining <code>QT_NO_CAST_FROM_ASCII</code> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p> <p>This function was introduced in Qt 5.0.</p> <!-- @@@operator<= --> <!-- $$$operator==[overload1]$$$operator==constQString& --> <h3 class="fn" id="operator-eq-eq"><a name="operator-eq-eq"></a><span class="type">bool</span> QLatin1String::<span class="name">operator==</span>(const <span class="type"><a href="qstring.html">QString</a></span> &<i>other</i>) const</h3> <p>Returns <code>true</code> if this string is equal to string <i>other</i>; otherwise returns <code>false</code>.</p> <p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>().</p> <!-- @@@operator== --> <!-- $$$operator==$$$operator==constchar* --> <h3 class="fn" id="operator-eq-eq-1"><a name="operator-eq-eq-1"></a><span class="type">bool</span> QLatin1String::<span class="name">operator==</span>(const <span class="type">char</span> *<i>other</i>) const</h3> <p>This is an overloaded function.</p> <p>The <i>other</i> const char pointer is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromUtf8">QString::fromUtf8</a>() function.</p> <p>You can disable this operator by defining <code>QT_NO_CAST_FROM_ASCII</code> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p> <p>This function was introduced in Qt 4.3.</p> <!-- @@@operator== --> <!-- $$$operator==$$$operator==constQByteArray& --> <h3 class="fn" id="operator-eq-eq-2"><a name="operator-eq-eq-2"></a><span class="type">bool</span> QLatin1String::<span class="name">operator==</span>(const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &<i>other</i>) const</h3> <p>This is an overloaded function.</p> <p>The <i>other</i> byte array is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromUtf8">QString::fromUtf8</a>() function.</p> <p>You can disable this operator by defining <code>QT_NO_CAST_FROM_ASCII</code> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p> <p>This function was introduced in Qt 5.0.</p> <!-- @@@operator== --> <!-- $$$operator>[overload1]$$$operator>constQString& --> <h3 class="fn" id="operator-gt"><a name="operator-gt"></a><span class="type">bool</span> QLatin1String::<span class="name">operator></span>(const <span class="type"><a href="qstring.html">QString</a></span> &<i>other</i>) const</h3> <p>Returns <code>true</code> if this string is lexically greater than string <i>other</i>; otherwise returns <code>false</code>.</p> <p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>().</p> <!-- @@@operator> --> <!-- $$$operator>$$$operator>constchar* --> <h3 class="fn" id="operator-gt-1"><a name="operator-gt-1"></a><span class="type">bool</span> QLatin1String::<span class="name">operator></span>(const <span class="type">char</span> *<i>other</i>) const</h3> <p>This is an overloaded function.</p> <p>The <i>other</i> const char pointer is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromUtf8">QString::fromUtf8</a>() function.</p> <p>You can disable this operator by defining <code>QT_NO_CAST_FROM_ASCII</code> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p> <p>This function was introduced in Qt 4.3.</p> <!-- @@@operator> --> <!-- $$$operator>$$$operator>constQByteArray& --> <h3 class="fn" id="operator-gt-2"><a name="operator-gt-2"></a><span class="type">bool</span> QLatin1String::<span class="name">operator></span>(const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &<i>other</i>) const</h3> <p>This is an overloaded function.</p> <p>The <i>other</i> const char pointer is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromUtf8">QString::fromUtf8</a>() function.</p> <p>You can disable this operator by defining <code>QT_NO_CAST_FROM_ASCII</code> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p> <p>This function was introduced in Qt 5.0.</p> <!-- @@@operator> --> <!-- $$$operator>=[overload1]$$$operator>=constQString& --> <h3 class="fn" id="operator-gt-eq"><a name="operator-gt-eq"></a><span class="type">bool</span> QLatin1String::<span class="name">operator>=</span>(const <span class="type"><a href="qstring.html">QString</a></span> &<i>other</i>) const</h3> <p>Returns <code>true</code> if this string is lexically greater than or equal to string <i>other</i>; otherwise returns <code>false</code>.</p> <p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings with <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>().</p> <!-- @@@operator>= --> <!-- $$$operator>=$$$operator>=constchar* --> <h3 class="fn" id="operator-gt-eq-1"><a name="operator-gt-eq-1"></a><span class="type">bool</span> QLatin1String::<span class="name">operator>=</span>(const <span class="type">char</span> *<i>other</i>) const</h3> <p>This is an overloaded function.</p> <p>The <i>other</i> const char pointer is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromUtf8">QString::fromUtf8</a>() function.</p> <p>You can disable this operator by defining <code>QT_NO_CAST_FROM_ASCII</code> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p> <p>This function was introduced in Qt 4.3.</p> <!-- @@@operator>= --> <!-- $$$operator>=$$$operator>=constQByteArray& --> <h3 class="fn" id="operator-gt-eq-2"><a name="operator-gt-eq-2"></a><span class="type">bool</span> QLatin1String::<span class="name">operator>=</span>(const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &<i>other</i>) const</h3> <p>This is an overloaded function.</p> <p>The <i>other</i> array is converted to a <a href="qstring.html">QString</a> using the <a href="qstring.html#fromUtf8">QString::fromUtf8</a>() function.</p> <p>You can disable this operator by defining <code>QT_NO_CAST_FROM_ASCII</code> when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through <a href="qobject.html#tr">QObject::tr</a>(), for example.</p> <p>This function was introduced in Qt 5.0.</p> <!-- @@@operator>= --> <!-- $$$operator[][overload1]$$$operator[]int --> <h3 class="fn" id="operator-5b-5d"><a name="operator-5b-5d"></a><span class="type"><a href="qlatin1char.html">QLatin1Char</a></span> QLatin1String::<span class="name">operator[]</span>(<span class="type">int</span> <i>pos</i>) const</h3> <p>Returns the character at position <i>pos</i> in this object.</p> <p><b>Note: </b>This function performs no error checking. The behavior is undefined when <i>pos</i> < 0 or <i>pos</i> >= <a href="qlatin1string.html#size">size</a>().</p><p>This function was introduced in Qt 5.8.</p> <p><b>See also </b><a href="qlatin1string.html#at">at</a>().</p> <!-- @@@operator[] --> </div> <div class="relnonmem"> <h2>Related Non-Members</h2> <!-- $$$operator!=$$$operator!=QLatin1StringQLatin1String --> <h3 class="fn" id="operator-not-eq-3"><a name="operator-not-eq-3"></a><span class="type">bool</span> <span class="name">operator!=</span>(<span class="type"><a href="qlatin1string.html#QLatin1String">QLatin1String</a></span> <i>s1</i>, <span class="type"><a href="qlatin1string.html#QLatin1String">QLatin1String</a></span> <i>s2</i>)</h3> <p>Returns <code>true</code> if string <i>s1</i> is lexically unequal to string <i>s2</i>; otherwise returns <code>false</code>.</p> <!-- @@@operator!= --> <!-- $$$operator<$$$operator<QLatin1StringQLatin1String --> <h3 class="fn" id="operator-lt-3"><a name="operator-lt-3"></a><span class="type">bool</span> <span class="name">operator<</span>(<span class="type"><a href="qlatin1string.html#QLatin1String">QLatin1String</a></span> <i>s1</i>, <span class="type"><a href="qlatin1string.html#QLatin1String">QLatin1String</a></span> <i>s2</i>)</h3> <p>Returns <code>true</code> if string <i>s1</i> is lexically smaller than string <i>s2</i>; otherwise returns <code>false</code>.</p> <!-- @@@operator< --> <!-- $$$operator<=$$$operator<=QLatin1StringQLatin1String --> <h3 class="fn" id="operator-lt-eq-3"><a name="operator-lt-eq-3"></a><span class="type">bool</span> <span class="name">operator<=</span>(<span class="type"><a href="qlatin1string.html#QLatin1String">QLatin1String</a></span> <i>s1</i>, <span class="type"><a href="qlatin1string.html#QLatin1String">QLatin1String</a></span> <i>s2</i>)</h3> <p>Returns <code>true</code> if string <i>s1</i> is lexically smaller than or equal to string <i>s2</i>; otherwise returns <code>false</code>.</p> <!-- @@@operator<= --> <!-- $$$operator==$$$operator==QLatin1StringQLatin1String --> <h3 class="fn" id="operator-eq-eq-3"><a name="operator-eq-eq-3"></a><span class="type">bool</span> <span class="name">operator==</span>(<span class="type"><a href="qlatin1string.html#QLatin1String">QLatin1String</a></span> <i>s1</i>, <span class="type"><a href="qlatin1string.html#QLatin1String">QLatin1String</a></span> <i>s2</i>)</h3> <p>Returns <code>true</code> if string <i>s1</i> is lexically equal to string <i>s2</i>; otherwise returns <code>false</code>.</p> <!-- @@@operator== --> <!-- $$$operator>$$$operator>QLatin1StringQLatin1String --> <h3 class="fn" id="operator-gt-3"><a name="operator-gt-3"></a><span class="type">bool</span> <span class="name">operator></span>(<span class="type"><a href="qlatin1string.html#QLatin1String">QLatin1String</a></span> <i>s1</i>, <span class="type"><a href="qlatin1string.html#QLatin1String">QLatin1String</a></span> <i>s2</i>)</h3> <p>Returns <code>true</code> if string <i>s1</i> is lexically greater than string <i>s2</i>; otherwise returns <code>false</code>.</p> <!-- @@@operator> --> <!-- $$$operator>=$$$operator>=QLatin1StringQLatin1String --> <h3 class="fn" id="operator-gt-eq-3"><a name="operator-gt-eq-3"></a><span class="type">bool</span> <span class="name">operator>=</span>(<span class="type"><a href="qlatin1string.html#QLatin1String">QLatin1String</a></span> <i>s1</i>, <span class="type"><a href="qlatin1string.html#QLatin1String">QLatin1String</a></span> <i>s2</i>)</h3> <p>Returns <code>true</code> if string <i>s1</i> is lexically greater than or equal to string <i>s2</i>; otherwise returns <code>false</code>.</p> <!-- @@@operator>= --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. </p> </div> </body> </html>