[Qt-interest] QString::size()

Giuseppe D'Angelo dangelog at gmail.com
Fri Sep 2 12:56:43 CEST 2011


On Fri, Sep 2, 2011 at 10:15 AM,  <nandita-a.mehta at nokia.com> wrote:
> Any clarification on what does the above sentence in the documentation?

The keyword there is "embeds". The trailing \0 is not "embedded" in the string.

    QString string("foo bar");
    string[3] = QChar(0x0000);
    qDebug() << string.length() << string.toUtf8().toHex();

will print

7 "666f6f00626172"

(notice the 00).

> And I thought that is the difference between QString::size() and
> QString::length(). But not

There's no difference between size() and length().

-- 
Giuseppe D'Angelo



More information about the Qt-interest-old mailing list