Didn't add the list... I guess the closest you get with a pure QByteArray solution is a two-step operation: auto x = QByteArray::Number(6).rightJustified(10, '0');
-Even -----Original Message----- From: Interest [mailto:interest-boun...@qt-project.org] On Behalf Of Kristoffersen, Even (NO14) via Interest Sent: onsdag 18. september 2019 14:28 To: Jason H <jh...@gmx.com>; interest@qt-project.org Subject: Re: [Interest] [External] QByteArray vs QString, arg, why is there no arg()? 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 _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest