[Interest] String best practice

Thiago Macieira thiago.macieira at intel.com
Tue Mar 14 16:56:43 CET 2017


On terça-feira, 14 de março de 2017 02:50:57 PDT Konstantin Tokarev wrote:
> > 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?
> You should use QByteArray here, which is what QIODevice::readLine() returns.
> Avoid using QString as long as possible because that will trigger
> conversion of your text to UTF16 encoding, which may be totally useless in
> your use case.

You can do that if you are doing binary comparisons.

If you want to be flexible as to the encoding of your file, I'd use QTextStream 
and compare to QString.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list