How can I convert a number (double) to string, with custom decimal point and thousand separator chars?
I\'ve seen QLocale, but I don\'t want to choose the localization c
pretty horrible, but got the job done
double doubleNumber = 5234556.3545;
int precision = 2;
QString stringNumber = QString::number(doubleNumber, 'f', precision);
for(int point = 0, i = (stringNumber.lastIndexOf('.') == -1 ? stringNumber.length() : stringNumber.lastIndexOf('.')); i > 0; --i, ++point)
{
if(point != 0 && point % 3 == 0)
{
stringNumber.insert(i, ',');
}
}