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

Referenced by QLocalSocketPrivate::_q_connectToSocket(), QResource::addSearchPath(), QTextCodec::availableCodecs(), QTextCodec::availableMibs(), QFSFileEnginePrivate::canonicalized(), QDir::cd(), Q3ComboBox::completionIndex(), QScriptDebuggerConsoleCommandManager::completions(), QLocalSocket::connectToServer(), QScriptDebuggerConsole::consumeInput(), QResourceFileEngineHandler::create(), QAbstractFileEngine::create(), Q3MimeSourceFactory::data(), Q3ImageDrag::encodedData(), QPatternist::CaseInsensitiveStringComparator::equals(), QPatternist::CodepointEqualFN::evaluateSingleton(), QNetworkDiskCache::expire(), QHelpEngineCore::fileData(), QFSFileEngine::fileName(), IndexListModel::filter(), QHelpIndexModel::filter(), QHelpEngineCore::findFile(), Q3ListView::findItem(), Q3IconView::findItem(), Q3ListBox::findItem(), Q3ListBoxPrivate::findItemByName(), Q3IconView::findItemByName(), QDateTimeParser::findMonth(), QUrl::fromLocalFile(), QDateTime::fromString(), QDirModel::index(), QHelpContentWidget::indexOf(), QUrl::isParentOf(), QDBusUtil::isValidBusName(), QDBusUtil::isValidObjectPath(), QDBusUtil::isValidUniqueConnectionName(), TabbedBrowser::keyPressEvent(), CentralWidget::keyPressEvent(), QTranslator::load(), HelpDialog::locateLink(), QAbstractItemModel::match(), CppCodeParser::matchDeclList(), QApplicationArgumentParser::parse(), QDateTimeParser::parseSection(), QFSCompletor::pathFromIndex(), QGtkStyle::pixelMetric(), CppCodeParser::processOtherMetaCommand(), qdesigner_internal::WidgetBoxTreeWidget::readWidget(), QDir::relativeFilePath(), QNetworkDiskCachePrivate::removeFile(), QSslSocketPrivate::resetDefaultCiphers(), QAbstractSocketPrivate::resolveProxy(), QColor::setNamedColor(), QCompleter::splitPath(), QFSCompletor::splitPath(), JambiApiParser::startElement(), Widget::startsWithFunction(), QDesktopServices::storageLocation(), QAbstractSpinBoxPrivate::stripped(), Config::subVars(), QClipboard::text(), QUrl::toString(), Q3UriDrag::unicodeUriToUri(), and QSpinBoxValidator::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 {
        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