On Tuesday February 21 2012, Marc Mutz wrote: > On Tuesday February 21 2012, you wrote: > > On Tue, Feb 21, 2012 at 3:20 PM, <[email protected]> wrote: > > > Is there any reason why we cannot move QString::asprintf() to > > > QByteArray::asprintf() instead? > > > > If your data is already in a QString, you're going to pay a rather > > large penalty to copy it all to a byte array just to use that, and > > then convert it back. > > That's exactly what QString::sprintf does right now - it only works on 8bit > strings, even though it stores the result in a QString.
It does use QLocale methods for formatting, and it supports the l modifier to %s. For a port to QByteArray, we'd need to define what encoding to assume (QString expects utf-8 on input, and we'd keep that, but we need to decide which encoding to _output_). Thanks, Marc -- Marc Mutz <[email protected]> | Senior Software Engineer KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090 KDAB - Qt Experts - Platform-Independent Software Solutions _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
