Remove traling zeros from QString scientific notation num value
Unsolved
Installation and Deployment
-
I have the next code, this code print a value in scientific notation, but i want to remove the trailing zeros
valor = 541; QString cStyleResult = QString::number(valor.toDouble(), 'e');
qDebug() << cStyleResult ;
//////////////////////////////////////////////
output: 5.410000e2I want to remove the trailing zeros(right decimal zeros), example I want to save only the value of 5.41
some ideas????
-
@LiamEvans210 Search for the 'e', remove all before it until it's != '0'
-
@LiamEvans210 You could also specify the precision (third parameter in QString::number()).