I'm trying to present some values to the user with an order dictated by a "template", if we can call it like that.
An example: Let's imagine that we have some variables called "ID/Name/Surname" of a person. And then, we have a template string like
"{Id}, {Name}{Surname}"
So the string shown would be "1, Max Power". Or if we have a template string like
"{Surname}, {Name}"
We would have a result like "Power, Max".
What I have thought is doing it with nested replaces, like
Replace(Replace(Replace(templateString, "{Surname}", surname), "{Name}", name), "{Id}", id) //Being surname, name, and id variables
But there should be a better or better stylish way of doing that. How can I achieve this? Regular expressions?
Thanks.