Logo Search packages:      
Sourcecode: qt-x11-free version File versions

int QString::find ( QChar  c,
int  index = 0,
bool  cs = TRUE 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Finds the first occurrence of the character c, starting at position index. If index is -1, the search starts at the last character; if -2, at the next to last character and so on. (See findRev() for searching backwards.)

If cs is TRUE (the default), the search is case sensitive; otherwise the search is case insensitive.

Returns the position of c or -1 if c could not be found.

Definition at line 2776 of file qstring.cpp.

References length(), lower(), and unicode().

Referenced by QApplication::applicationFilePath(), QKeySequence::assign(), QFileInfo::baseName(), QDir::cd(), QMenuData::changeItem(), QHttpHeader::contentType(), QMotifPlusStyle::drawControl(), QSGIStyle::drawControl(), QMotifStyle::drawControl(), QWindowsStyle::drawControl(), QTextDrag::encodedData(), QSettings::entryList(), QSqlQuery::exec(), QFileInfo::extension(), find(), QCString::find(), QXmlInputSource::fromRawData(), QFont::fromString(), QDate::fromString(), QDateTime::fromString(), Uic::getFormClassName(), QUrl::isRelativeUrl(), QMenuBar::keyPressEvent(), QPopupMenu::keyPressEvent(), QUriDrag::localFileToUri(), QStyleSheet::mightBeRichText(), QTextEdit::optimSetTextFormat(), QHttpHeader::parse(), QUrl::parse(), QFontDatabase::parseFontName(), QHttpResponseHeader::parseLine(), QHttpHeader::parseLine(), QTextEdit::pasteSubType(), QFileDialog::QFileDialog(), Uic::registerObject(), remove(), QUrl::setEncodedPathAndQuery(), QAccel::shortcutKey(), QTableItem::sizeHint(), QStringList::split(), QXmlNamespaceSupport::splitName(), QSettings::subkeyList(), QComponentFactory::unregisterComponent(), QPopupMenu::updateAccel(), QPopupMenu::updateSize(), and QDoubleValidator::validate().

    const uint l = length();
    if ( index < 0 )
      index += l;
    if ( (uint)index >= l )
      return -1;
    register const QChar *uc = unicode()+index;
    const QChar *end = unicode() + l;
    if ( cs ) {
      while ( uc < end && *uc != c )
    } else {
      c = ::lower( c );
      while ( uc < end && ::lower( *uc ) != c )
    if ( uint(uc - unicode()) >= l )
      return -1;
    return (int)(uc - unicode());

Generated by  Doxygen 1.6.0   Back to index