Primitive question, but how do I format strings like this:
\"Step {1} of {2}\"
by substituting variables using Java? In C# it\'s
This solution worked for me. I needed to create urls for a REST client dynamically so I created this method, so you just have to pass the restURL like this
/customer/{0}/user/{1}/order
and add as many params as you need:
public String createURL (String restURL, Object ... params) {
return new MessageFormat(restURL).format(params);
}
You just have to call this method like this:
createURL("/customer/{0}/user/{1}/order", 123, 321);
The output
"/customer/123/user/321/order"