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.

doc/src/snippets/qstring/main.cpp 65

See also:
endsWith()

Definition at line 2857 of file qstring.cpp.

References d.

Referenced by QResource::addSearchPath(), QTextCodec::availableCodecs(), QTextCodec::availableMibs(), QDir::cd(), Q3ComboBox::completionIndex(), QAbstractFileEngine::create(), Q3MimeSourceFactory::data(), Q3ImageDrag::encodedData(), QPatternist::CaseInsensitiveStringComparator::equals(), QPatternist::CodepointEqualFN::evaluateSingleton(), QHelpEngineCore::fileData(), QFSFileEngine::fileName(), QHelpIndexModel::filter(), QHelpEngineCore::findFile(), Q3ListView::findItem(), Q3IconView::findItem(), Q3ListBox::findItem(), Q3IconView::findItemByName(), QUrl::fromLocalFile(), QDirModel::index(), QHelpContentWidget::indexOf(), QUrl::isParentOf(), QDBusUtil::isValidBusName(), QDBusUtil::isValidObjectPath(), QDBusUtil::isValidUniqueConnectionName(), QTranslator::load(), QAbstractItemModel::match(), QApplicationArgumentParser::parse(), QFSCompletor::pathFromIndex(), QDir::relativeFilePath(), QColor::setNamedColor(), QCompleter::splitPath(), QFSCompletor::splitPath(), QDesktopServices::storageLocation(), Config::subVars(), QClipboard::text(), QUrl::toString(), QCoreApplication::translate(), and Q3UriDrag::unicodeUriToUri().

{
    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 {
        uint last = 0;
        uint olast = 0;
        for (int i = 0; i < s.d->size; ++i)
            if (foldCase(d->data[i], last) != foldCase(s.d->data[i], olast))
                return false;
    }
    return true;
}


Generated by  Doxygen 1.6.0   Back to index