int QString::size () const
Returns the number of characters in this string.
The last character in the string is at position size() - 1. In addition, QString ensures that the character at position size() is always '/0', so that you can use the return value of data() and constData() as arguments to functions that expect '/0'-terminated strings.
Example:
QString str = "World";
int n = str.size(); // n == 5
str.data()[0]; // returns 'W'
str.data()[4]; // returns 'd'
str.data()[5]; // returns '/0'