Solved AnsiString equivalent in qt
-
Hi All
I am re-writing some old C++ Builder code into Qt, and have come across a variable type:
AnsiString m_name;
From what I gather it is a form of 'long string', can anyone help me out with what the equivalent is in Qt?
Thanks
J
-
@James-Sprinks could you provide some more context about how this variable is used, i.e. what values is assigned, how is employed in your code?
-
If you are referring to this class then
QString
works and uses UTF8. If you rely on the fact that it will use the system encoding method then restrict interations with it to useQTextStream
. -
Hi
QString will do anything you are used to AnsiString does. ( it seems so far)
The only surprise is that
int val=10;
QString test ="val = " + val;
Does NOT give you "Val =10" as AnsiString would.
In Qt that is
QString test ="val = " + QString::number(val);