[Interest] String best practice

Harald Vistnes harald.vistnes at gmail.com
Tue Mar 14 10:43:24 CET 2017


Hi,

I'm currently working on reading and parsing large ASCII based text files
and I am wondering what is the current best practice. There are so many
classes and macros available, so it can be a bit confusing to know what to
use when.

QString, QLatin1String, QByteArray, QStringLiteral, QLatin1Literal,
QByteArrayLiteral, plain C++ string literal, QStringRef, QStringBuilder and
so on. And then std::string and raw const char* strings.

In my case I want to read a large ASCII file line by line, so I don't need
unicode. I need to compare a string with a literal, extract substrings and
convert some strings to numbers.

Should I just use QString all the way, or is it faster to use some other
classes when you know you don't need unicode?

Any hints on fast file parsing code in Qt itself that I could use as a
guildeline?

Thanks,
Harald
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170314/1d70fae2/attachment.html>


More information about the Interest mailing list