Hi,
is there a Qt-way to convert an integer (for example a file size) into a string with dots between the digits?
like this: 1.234.567
Klaus
Hi,
is there a Qt-way to convert an integer (for example a file size) into a string with dots between the digits?
like this: 1.234.567
Klaus
you can use QString::number() to convert the int into a QString and then according to the length of the string you can insert '.' where ever you want.
If you use QLocale::toString with properly set locale, you'll get your dotted outputOriginally Posted by klaus1111
Of course you can use this code...
Regards,Qt Code:
int w_size = word.size(); if (w_size > 3) { word.insert(word.size() - 3, "."); } if (w_size > 6) { word.insert(word.size() - 7, "."); }To copy to clipboard, switch view to plain text mode
Luka
Or any other localized output in the world. I've used it to display prices and it is a true timesaver. I think it's available only after Qt 3.3.2.Originally Posted by wysota
Eeem... 3.3.0 x.y.z versions are just bug fixes, no new features are added, so it must have been a "0" release. But the point here is that with using QLocale you can have output from a different locale than the rest of the application uses.
Yes fast typing played it's role . Just confirmed no QLocale in 3.2.x, it's a 3.3.x additionOriginally Posted by wysota
Last edited by yop; 6th January 2006 at 22:08.
Bookmarks