Want to take an interger and produce a zero padded string output.
Can this be done in Qt?
e.g.
int i = 5;
QString str = ( code ... );
qDebug() << str; // prints 0005
Cheers
Want to take an interger and produce a zero padded string output.
Can this be done in Qt?
e.g.
int i = 5;
QString str = ( code ... );
qDebug() << str; // prints 0005
Cheers
Try with QString::arg(). You may pass a custom field width and a filling character.
J-P Nurmi
Harvey West (27th February 2007)
Try QString::leftJustified or QString::rightJustified. This should work for you.
Bookmarks