[Interest] [External] QByteArray vs QString, arg, why is there no arg()?
Kristoffersen, Even (NO14)
Even.Kristoffersen at Honeywell.com
Wed Sep 18 14:28:08 CEST 2019
Just use the fill() function: https://doc.qt.io/qt-5/qbytearray.html#fill
From: Interest [mailto:interest-bounces at qt-project.org] On Behalf Of Jason H
Sent: onsdag 18. september 2019 13:16
To: interest at 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 at qt-project.org
More information about the Interest