
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQStringMatcher class holds a sequence of characters that can be quickly matched in a Unicode string.More...
| Header: | #include <QStringMatcher> |
| QStringMatcher() | |
| QStringMatcher(const QString & pattern, Qt::CaseSensitivity cs = Qt::CaseSensitive) | |
| QStringMatcher(const QChar * uc, int length, Qt::CaseSensitivity cs = Qt::CaseSensitive) | |
| QStringMatcher(const QStringMatcher & other) | |
| ~QStringMatcher() | |
| Qt::CaseSensitivity | caseSensitivity() const |
| int | indexIn(const QString & str, int from = 0) const |
| int | indexIn(const QChar * str, int length, int from = 0) const |
| QString | pattern() const |
| void | setCaseSensitivity(Qt::CaseSensitivity cs) |
| void | setPattern(const QString & pattern) |
| QStringMatcher & | operator=(const QStringMatcher & other) |
TheQStringMatcher class holds a sequence of characters that can be quickly matched in a Unicode string.
This class is useful when you have a sequence ofQChars 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 andindexIn() is faster than matching a plainQString withQString::indexOf() if repeated matching takes place. This class offers no benefit if you are doing one-off string matches.
Create theQStringMatcher with theQString you want to search for. Then callindexIn() on theQString that you want to search.
See alsoQString,QByteArrayMatcher, andQRegExp.
Constructs an empty string matcher that won't match anything. CallsetPattern() to give it a pattern to match.
Constructs a string matcher that will search forpattern, with case sensitivitycs.
CallindexIn() to perform a search.
Constructs a string matcher that will search for the pattern referred to byuc with the givenlength and case sensitivity specified bycs.
This function was introduced in Qt 4.5.
Copies theother string matcher to this string matcher.
Destroys the string matcher.
Returns the case sensitivity setting for this string matcher.
See alsosetCaseSensitivity().
Searches the stringstr from character positionfrom (default 0, i.e. from the first character), for the stringpattern() that was set in the constructor or in the most recent call tosetPattern(). Returns the position where thepattern() matched instr, or -1 if no match was found.
See alsosetPattern() andsetCaseSensitivity().
Searches the string starting atstr (of lengthlength) from character positionfrom (default 0, i.e. from the first character), for the stringpattern() that was set in the constructor or in the most recent call tosetPattern(). Returns the position where thepattern() matched instr, or -1 if no match was found.
This function was introduced in Qt 4.5.
See alsosetPattern() andsetCaseSensitivity().
Returns the string pattern that this string matcher will search for.
See alsosetPattern().
Sets the case sensitivity setting of this string matcher tocs.
See alsocaseSensitivity(),setPattern(), andindexIn().
Sets the string that this string matcher will search for topattern.
See alsopattern(),setCaseSensitivity(), andindexIn().
Assigns theother string matcher to this string matcher.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. 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.