I would like to know if {fmt} library allows to amend only one positional argument in string containing several positional arguments ?
Here is my test which doesn't work and {fmt} documentation shows no solution
std::string text = "{name} is {nb} years old and lives in {city}";
try
{
text = fmt::format(text, fmt::arg("name", "John"));
}
catch (const fmt::format_error::exception &e)
{
std::cout << e.what() << std::endl;
}
I would like to get John is {nb} years old and lives in {city}, is it possible ?
No. Referring to a non-existent argument, positional or not, is an error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With