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

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 1993 of file qstring.cpp.

Referenced by QKeySequence::assign(), QDir::cd(), QFileInfo::completeSuffix(), contains(), QHttpHeader::contentType(), count(), QPlastiqueStyle::drawControl(), QMotifStyle::drawControl(), QWindowsStyle::drawControl(), QWindowsXPStyle::drawControl(), QSqlResult::exec(), QUrl::fromLocalFile(), QXmlInputSource::fromRawData(), QDate::fromString(), QDateTime::fromString(), indexOf(), 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(), 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 = ::lower(ch);
            while (++n != e)
                if (::lower(*n) == ch)
                    return  n - (const QChar*)d->data;
        }
    }
    return -1;
}


Generated by  Doxygen 1.6.0   Back to index