Skip to content

Commit

Permalink
avoid having qgsDoubleToString printing -0
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Oct 10, 2018
1 parent eeee43d commit 12ead91
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/qgis.h
Expand Up @@ -20,7 +20,7 @@

#include <QEvent>
#include <QString>
#include <QRegExp>
#include <QRegularExpression>
#include <QMetaType>
#include <QMap>
#include <QMetaEnum>
Expand Down Expand Up @@ -239,7 +239,7 @@ CORE_EXPORT uint qHash( const QVariant &variant );
inline QString qgsDoubleToString( double a, int precision = 17 )
{
if ( precision )
return QString::number( a, 'f', precision ).remove( QRegExp( "\\.?0+$" ) );
return QString::number( a, 'f', precision ).remove( QRegularExpression( "\\.?0+$" ) ).replace( QRegularExpression( "^-0$" ), QStringLiteral( "0" ) );
else
return QString::number( a, 'f', precision );
}
Expand Down

0 comments on commit 12ead91

Please sign in to comment.