std::string str = "Hello "; str.AppendFormat("world! My name is %s.", "John"); // Result: "Hello world! My name is John."
std::string str = "Pi is approximately: "; double pi = 3.14159265; str.AppendFormat("%.2f", pi); // Result: "Pi is approximately: 3.14"
std::string str = "There are"; int num = 5; str.AppendFormat(" %d apples in the basket.", num); // Result: "There are 5 apples in the basket."These examples demonstrate how `AppendFormat` can be used to concatenate formatted data to an existing `std::string`. It is part of the C++ Standard Library and is included in the `string` header file.