Logo Search packages:      
Sourcecode: qt4-x11 version File versions

int QString::indexOf ( QChar  ch,
int  from = 0,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the index position of the first occurrence of the character ch in the string, searching forward from index position from. Returns -1 if ch could not be found.

Definition at line 2042 of file qstring.cpp.

Referenced by QKeySequence::assign(), QDBusAbstractInterface::callWithArgumentList(), QDBusAbstractInterface::callWithCallback(), QDir::cd(), QFileInfo::completeSuffix(), contains(), QHttpHeader::contentType(), count(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QMotifStyle::drawControl(), QWindowsStyle::drawControl(), QWindowsXPStyle::drawControl(), QItemDelegate::drawDisplay(), QSqlResult::exec(), QUrl::fromLocalFile(), QXmlInputSource::fromRawData(), QDate::fromString(), QDateTime::fromString(), indexOf(), QDBusUtil::isValidObjectPath(), QMenu::keyPressEvent(), QMenuBar::keyPressEvent(), Q3UriDrag::localFileToUri(), QFSFileEngine::mkdir(), QKeySequence::mnemonic(), Q3TextEdit::optimSetTextFormat(), QHttpHeader::parse(), QHttpResponseHeader::parseLine(), QHttpHeader::parseLine(), Q3TextEdit::pasteSubType(), Q3FileDialog::Q3FileDialog(), remove(), QUrl::setUrl(), split(), QXmlNamespaceSupport::splitName(), QCoreApplication::translate(), and QDoubleValidator::validate().

    if (from < 0)
        from = qMax(from + d->size, 0);
    if (from  < d->size) {
        const QChar *n = (const QChar*)d->data + from - 1;
        const QChar *e = (const QChar*)d->data + d->size;
        if (cs == Qt::CaseSensitive) {
            while (++n != e)
                if (*n == ch)
                    return  n - (const QChar*)d->data;
        } else {
            ch = QUnicodeTables::lower(ch);
            while (++n != e)
                if (QUnicodeTables::lower(*n) == ch)
                    return  n - (const QChar*)d->data;
    return -1;

Generated by  Doxygen 1.6.0   Back to index