I'm working on a razor page where I need to drop a series of custom fields from a variable-attribute tables. My purpose is to replace a specific pairing of symbols ('{}') with an htmlstring. To simplify however lets say i wanted to replace it with an incremental number.
This is pseudo-code for what i'm looking for.
string s = "This sample will count: {}, {}, {}."
int i = 0;
while(*string not finished*)//?
{
i ++;
s.Replace("{}", i);
}
Output:
"This sample will count 1, 2, 3."
Is this something I need to use regex on? Any other thoughts?
EDIT
I should clarify: I am not aware of how many '{}'s until run time. The numbers may be throwing people off, I'm liking going to do something more akin to:
s.replace("{}", stringArray[i]);
.NET. Can only transform from one string to another.string.Format(), but without numbers inside the braces?