I have a string as follows
Hey {1}, you are {2}.
Here 1
and 2
are key whose value will be added dynamically.
Now I need to replace {1}
with the value that 1
represents and then I need to replace {2}
with the value that 2
represents in the sentence above.
How do I do it?
I know what split function of a string does and I know very well that with that function I can do what I want but I am looking for something better.
Note: I don't know what these keys are in advance. I need to retrieve the keys as well. And then according to the keys I need to replace the values in the string.