[Qt-interest] QString::size()

nandita-a.mehta at nokia.com nandita-a.mehta at nokia.com
Fri Sep 2 10:15:19 CEST 2011


Hi,

In the documentation (http://doc.qt.nokia.com/latest/qstring.html) it is mentioned that

"A QString can embed '\0' characters (QChar::Null<http://doc.qt.nokia.com/latest/qchar.html#SpecialCharacter-enum>). The size<http://doc.qt.nokia.com/latest/qstring.html#size>() function always returns the size of the whole string, including embedded '\0' characters."

And I was expecting the output as 6 (including '\0') but it is 5.
QString str14 = "Apple";
qDebug()<<str14.size();  //5


Any clarification on what does the above sentence in the documentation?

And I thought that is the difference between QString::size() and QString::length(). But not
qDebug()<<str14.length(); //5

Thank You.

Regards,
Nandita

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110902/008bc945/attachment.html 


More information about the Qt-interest-old mailing list