I’ve seen something like this in code
somestring = "Today is {0}, tomorrow is {1}";
I know that it’ll put values into the string from another variable, but how do I do it?
Update: As there is several ways to achieve this effect, which way is the most effecient?
Have you looked at the MessageFormat documentation ?
e.g. (an example)
With respect to your question re. efficiency, I would only worry about this if you encounter performance issues and they relate to this. I would expect the above to be reasonably efficient – especially given there’ll likely be some output (to std. out or similar?) involved, which I’d expect to be a bigger bottleneck.