How can I fill with zeros at left? My code is:
QString reelId = QString("Month %1").arg(QDate::currentDate().month());
qDebug() << reelId;
and out is: Month 2 and I want Month 02;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The term you’re really looking for is “pad”, as in padding a string with something. Look through the QString documentation for this, specifically the various QString::arg() functions, which describes how to achieve this in a variety of ways 🙂