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

bool QString::startsWith ( const QString s,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const

Returns true if the string starts with s; otherwise returns false.

If cs is Qt::CaseSensitive (the default), the search is case sensitive; otherwise the search is case insensitive.

        QString str = "Bananas";
        str.startsWith("Ban");     // returns true
        str.startsWith("Car");     // returns false

See also:

Definition at line 2750 of file qstring.cpp.

References d.

Referenced by QTextCodec::availableCodecs(), QTextCodec::availableMibs(), QDir::cd(), Q3ComboBox::completionIndex(), Q3MimeSourceFactory::data(), QFSFileEngine::fileName(), Q3ListView::findItem(), Q3IconView::findItem(), Q3ListBox::findItem(), Q3IconView::findItemByName(), QUrl::fromLocalFile(), QXmlInputSource::fromRawData(), QDirModel::index(), QUrl::isParentOf(), Translator::load(), QTranslator::load(), QAbstractItemModel::match(), QClipboard::text(), Q3UriDrag::unicodeUriToUri(), and QDoubleValidator::validate().

    if (d == &shared_null)
        return (s.d == &shared_null);
    if (d->size == 0)
        return s.d->size == 0;
    if (s.d->size > d->size)
        return false;
    if (cs == Qt::CaseSensitive) {
        return memcmp((char*)d->data, (char*)s.d->data, s.d->size*sizeof(QChar)) == 0;
    } else {
        for (int i = 0; i < s.d->size; ++i)
            if (::lower(d->data[i]) != ::lower(s.d->data[i]))
                return false;
    return true;

Generated by  Doxygen 1.6.0   Back to index