TString str = "World"; str.Prepend("Hello "); std::cout << str;
TString str1 = "2021"; TString str2 = " Happy New Year!"; str1.Prepend(str2); std::cout << str1;This will output " Happy New Year!2021" to the console. The Prepend function adds the string stored in the variable "str2" to the beginning of the variable "str1". These examples use the TString function which is part of the ROOT package. It is a library for particle physics analysis, but it also includes a number of useful classes for general C++ programming including TString.