1、代码:
void MainWindow::on_pushButton_clicked()
{
QString str = "";
QString str01 = str.leftJustified(, '');
qDebug() << str01;
str01 = str.rightJustified(, '');
qDebug() << str01;
str01 = str.rightJustified(, '');
qDebug() << str01;
}
2、控制台输出:
"500"
"00005"
"05"
3、
4、
5、