Just use the fill() function: https://doc.qt.io/qt-5/qbytearray.html#fill
-Even -----Original Message----- From: Interest [mailto:interest-boun...@qt-project.org] On Behalf Of Jason H Sent: onsdag 18. september 2019 13:16 To: interest@qt-project.org Subject: [External] [Interest] QByteArray vs QString, arg, why is there no arg()? Shiver me timbers! I often find myself using QString::arg() overloads for formatting, but nothing like that exists for when I'm working with just bytes, say for a socket or serial port. So I find myself constructing it as a QString and then .toLocal8bit() , which just seems wasteful. What's the best way to zero-pad a QByteArray? What I want is QByteArray("%1").arg(6, 10, 10, '0') I'm guessing they is a good reason it hasn't been added yet? _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest