Skip to content

Commit

Permalink
leaner imitation of .arg
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jan 25, 2013
1 parent f6806a9 commit 45faef9
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/core/qgsexpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,15 +572,9 @@ static QVariant fcnLPad( const QVariantList& values, QgsFeature* , QgsExpression
static QVariant fcnFormatString( const QVariantList& values, QgsFeature* , QgsExpression *parent )
{
QString string = getStringValue( values.at( 0 ), parent );
for ( int n = 1; n <= values.length() - 1; n++ )
for ( int n = 1; n < values.length(); n++ )
{
QString arg = getStringValue( values.at( n ), parent );
QString place = '%' + QString::number( n );
if ( string.indexOf( place ) == -1 )
{
continue;
}
string.replace( place, arg );
string = string.arg( getStringValue( values.at( n ), parent ) );
}
return string;
}
Expand Down

0 comments on commit 45faef9

Please sign in to comment.