<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QStringMatcher Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QStringMatcher Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QStringMatcher class holds a sequence of characters that can be quickly matched in a Unicode string. <a href="#details">More...</a></p> <h3>Methods</h3><ul><li><div class="fn" /><b><a href="qstringmatcher.html#QStringMatcher">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qstringmatcher.html#QStringMatcher-2">__init__</a></b> (<i>self</i>, QString, Qt.CaseSensitivity <i>cs</i> = Qt.CaseSensitive)</li><li><div class="fn" /><b><a href="qstringmatcher.html#QStringMatcher-3">__init__</a></b> (<i>self</i>, QStringMatcher)</li><li><div class="fn" />Qt.CaseSensitivity <b><a href="qstringmatcher.html#caseSensitivity">caseSensitivity</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qstringmatcher.html#indexIn">indexIn</a></b> (<i>self</i>, QString, int <i>from</i> = 0)</li><li><div class="fn" />QString <b><a href="qstringmatcher.html#pattern">pattern</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qstringmatcher.html#setCaseSensitivity">setCaseSensitivity</a></b> (<i>self</i>, Qt.CaseSensitivity)</li><li><div class="fn" /><b><a href="qstringmatcher.html#setPattern">setPattern</a></b> (<i>self</i>, QString)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QStringMatcher class holds a sequence of characters that can be quickly matched in a Unicode string.</p> <p>This class is useful when you have a sequence of <a href="qchar.html">QChar</a>s that you want to repeatedly match against some strings (perhaps in a loop), or when you want to search for the same sequence of characters multiple times in the same string. Using a matcher object and <a href="qstringmatcher.html#indexIn">indexIn</a>() is faster than matching a plain <a href="qstring.html">QString</a> with <a href="qstring.html#indexOf">QString.indexOf</a>() if repeated matching takes place. This class offers no benefit if you are doing one-off string matches.</p> <p>Create the QStringMatcher with the <a href="qstring.html">QString</a> you want to search for. Then call <a href="qstringmatcher.html#indexIn">indexIn</a>() on the <a href="qstring.html">QString</a> that you want to search.</p> <p>See also <a href="qstring.html">QString</a>, <a href="qbytearraymatcher.html">QByteArrayMatcher</a>, and <a href="qregexp.html">QRegExp</a>.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QStringMatcher" />QStringMatcher.__init__ (<i>self</i>)</h3><p>Constructs an empty string matcher that won't match anything. Call <a href="qstringmatcher.html#setPattern">setPattern</a>() to give it a pattern to match.</p> <h3 class="fn"><a name="QStringMatcher-2" />QStringMatcher.__init__ (<i>self</i>, QString, <a href="qt.html#CaseSensitivity-enum">Qt.CaseSensitivity</a> <i>cs</i> = Qt.CaseSensitive)</h3><p>Constructs a string matcher that will search for <i>pattern</i>, with case sensitivity <i>cs</i>.</p> <p>Call <a href="qstringmatcher.html#indexIn">indexIn</a>() to perform a search.</p> <h3 class="fn"><a name="QStringMatcher-3" />QStringMatcher.__init__ (<i>self</i>, <a href="qstringmatcher.html">QStringMatcher</a>)</h3><p>Constructs a string matcher that will search for the pattern referred to by <i>uc</i> with the given <i>length</i> and case sensitivity specified by <i>cs</i>.</p> <p>This function was introduced in Qt 4.5.</p> <h3 class="fn"><a name="caseSensitivity" /><a href="qt.html#CaseSensitivity-enum">Qt.CaseSensitivity</a> QStringMatcher.caseSensitivity (<i>self</i>)</h3><p>Returns the case sensitivity setting for this string matcher.</p> <p>See also <a href="qstringmatcher.html#setCaseSensitivity">setCaseSensitivity</a>().</p> <a name="//apple_ref/cpp/instm/QStringMatcher/indexIn" /> <h3 class="fn"><a name="indexIn" />int QStringMatcher.indexIn (<i>self</i>, QString, int <i>from</i> = 0)</h3><p>Searches the string <i>str</i> from character position <i>from</i> (default 0, i.e. from the first character), for the string <a href="qstringmatcher.html#pattern">pattern</a>() that was set in the constructor or in the most recent call to <a href="qstringmatcher.html#setPattern">setPattern</a>(). Returns the position where the <a href="qstringmatcher.html#pattern">pattern</a>() matched in <i>str</i>, or -1 if no match was found.</p> <p>See also <a href="qstringmatcher.html#setPattern">setPattern</a>() and <a href="qstringmatcher.html#setCaseSensitivity">setCaseSensitivity</a>().</p> <h3 class="fn"><a name="pattern" />QString QStringMatcher.pattern (<i>self</i>)</h3><p>Returns the string pattern that this string matcher will search for.</p> <p>See also <a href="qstringmatcher.html#setPattern">setPattern</a>().</p> <a name="//apple_ref/cpp/instm/QStringMatcher/setCaseSensitivity" /> <h3 class="fn"><a name="setCaseSensitivity" />QStringMatcher.setCaseSensitivity (<i>self</i>, <a href="qt.html#CaseSensitivity-enum">Qt.CaseSensitivity</a>)</h3><p>Sets the case sensitivity setting of this string matcher to <i>cs</i>.</p> <p>See also <a href="qstringmatcher.html#caseSensitivity">caseSensitivity</a>(), <a href="qstringmatcher.html#setPattern">setPattern</a>(), and <a href="qstringmatcher.html#indexIn">indexIn</a>().</p> <a name="//apple_ref/cpp/instm/QStringMatcher/setPattern" /> <h3 class="fn"><a name="setPattern" />QStringMatcher.setPattern (<i>self</i>, QString)</h3><p>Sets the string that this string matcher will search for to <i>pattern</i>.</p> <p>See also <a href="qstringmatcher.html#pattern">pattern</a>(), <a href="qstringmatcher.html#setCaseSensitivity">setCaseSensitivity</a>(), and <a href="qstringmatcher.html#indexIn">indexIn</a>().</p> <a name="//apple_ref/cpp/instm/QStringMatcher/operator=" /> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.7.4 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt 4.6.3</td></tr></table></div></address></body></html>