PDA

View Full Version : trying to convert string to uppercase



max steel
15th June 2017, 08:56
Can anyone please help where did I make mistake please?


void Registr(QString str)
{
QString rezult = str;
for(int i = 0; i < str.size(); i++)
{
rezult[i] = toUpper(str[i]);
}
QMessageBox msg;
msg.setText(rezult);
msg.exec();
}

Santosh Reddy
16th June 2017, 06:34
toUpper() is a member function of QString class, you will have to call it on the QString object.

void Registr(QString str)
{
QMessageBox msg;
msg.setText(str.toUpper());
msg.exec();
}