Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Use QString::at(0) instead of left(1), since it's more efficient
and doesn't allocate a QString
- Loading branch information
|
@@ -87,7 +87,7 @@ void QgsAbout::init() |
|
|
{ |
|
|
line = stream.readLine(); // line of text excluding '\n' |
|
|
//ignore the line if it starts with a hash.... |
|
|
if ( line.left( 1 ) == "#" ) |
|
|
if ( line.at( 0 ) == '#' ) |
|
|
continue; |
|
|
QStringList myTokens = line.split( '\t', QString::SkipEmptyParts ); |
|
|
lines << myTokens[0]; |
|
@@ -119,7 +119,7 @@ void QgsAbout::init() |
|
|
{ |
|
|
line = stream.readLine(); // line of text excluding '\n' |
|
|
//ignore the line if it starts with a hash.... |
|
|
if ( line.left( 1 ) == "#" ) |
|
|
if ( line.at( 0 ) == '#' ) |
|
|
continue; |
|
|
lines += line; |
|
|
} |
|
|
|
@@ -648,7 +648,7 @@ static QVariant fcnTitle( const QVariantList& values, const QgsExpressionContext |
|
|
for ( int i = 0; i < elems.size(); i++ ) |
|
|
{ |
|
|
if ( elems[i].size() > 1 ) |
|
|
elems[i] = elems[i].left( 1 ).toUpper() + elems[i].mid( 1 ).toLower(); |
|
|
elems[i] = elems[i].at( 0 ).toUpper() + elems[i].mid( 1 ).toLower(); |
|
|
} |
|
|
return QVariant( elems.join( " " ) ); |
|
|
} |
|
|
|
@@ -1027,7 +1027,7 @@ QString QgsMapLayer::capitaliseLayerName( const QString& name ) |
|
|
QString layerName( name ); |
|
|
|
|
|
if ( capitaliseLayerName ) |
|
|
layerName = layerName.left( 1 ).toUpper() + layerName.mid( 1 ); |
|
|
layerName = layerName.at( 0 ).toUpper() + layerName.mid( 1 ); |
|
|
|
|
|
return layerName; |
|
|
} |
|
|
|
@@ -72,7 +72,7 @@ QT_BEGIN_NAMESPACE |
|
|
static QString _q_escapeIdentifier(const QString &identifier) |
|
|
{ |
|
|
QString res = identifier; |
|
|
if(!identifier.isEmpty() && identifier.left(1) != QString(QLatin1Char('"')) && identifier.right(1) != QString(QLatin1Char('"')) ) { |
|
|
if(!identifier.isEmpty() && identifier.at(0) != '"' && identifier.right(1) != QString(QLatin1Char('"')) ) { |
|
|
res.replace(QLatin1Char('"'), QLatin1String("\"\"")); |
|
|
res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); |
|
|
res.replace(QLatin1Char('.'), QLatin1String("\".\"")); |
|
|