QString str = "Hello World"; const QChar* end = str.end();
QString str = "This is a test"; QChar* end = const_castIn this example, the end() function is used to get a pointer to the null terminator character of the QString object. The const_cast operator is used to cast away the constness of the pointer, so that the null character can be modified. Then, the end pointer is dereferenced to set the null character to the exclamation mark character. Package library: Qt.(str.end()); *end = '!';