c++ - Does Qt5 have any class for similar to StringBuilder or StringBuffer? -
surprisingly, qt5 has deprecated stringbuilder
class present in previous versions. other option use qtextstream
, not convenient since have pass in buffer writes (e.g. qfile
, qstring
).
c++ (std::stringstream
), c# (stringbuilder
) , java (stringbuffer
) have these classes. how qt?
qstringbuilder
not deprecated. qt docs:
in 4.6, internal template class qstringbuilder has been added along few helper functions. class marked internal , not appear in documentation, because aren't meant instantiate in code. use automatic, described below. class found in src/corelib/tools/qstringbuilder.cpp if want have @ it.
their code sample:
#include <qstringbuilder> qstring hello("hello"); qstringref el(&hello, 2, 3); qlatin1string world("world"); qstring message = hello % el % world % qchar('!');
and can use c++ need std::stringstream
.
Comments
Post a Comment