If you need to format values into a std::string or extract formatted values from a std::string and are stuck in the pre-C++20 world, your main option is std::stringstream.
std::istringstream can be filled with a string and treated as any other istream object.
std::ostringstream can be treated as an ostream object with the option to extract the current content as std::string.
Compiler Explorer link: https://compiler-explorer.com/z/rYxYaxn37