I have a string var str1 = "My name is {{0}}, I am {{1}} years old."
I want to use String.Format(str1, 'Pavel', 29);
Of course it does not work, because String.Format() expects parameter placeholders to be in a single curly brackets
So, I have to modify my string like that:
for (int i = 0; i < 10; i++)
{
str1 = str1.Replace("{{" + i + "}}", "{" + i + "}");
}
I wonder if there is a better way of doing it ? Is there a way I can define the format of the argument placeholders ?
{and}as params