QString name = "John"; int age = 25; QString message = QString("My name is %1 and I am %2 years old.").arg(name).arg(age); // Output: "My name is John and I am 25 years old."
QString color = "red"; QString message = QString("The color of the car is %1.").arg(color.toUpper()); // Output: "The color of the car is RED."In this example, the `toUpper()` function is called on the `color` variable before passing it to the `arg` function. This converts the color string to uppercase before inserting it into the message. The QString arg function is part of the Qt Core library.