Efficient way to replace strings in java -
i have string template this:
http://server/{x}/{y}/{z}/{t}/{a}.json and have values:
int x=1,y=2,z=3,t=4,a=5; i want know efficent way replace {x} value of x, , y,z,t,z?
another way (c# way ;)):
messageformat mformat = new messageformat("http://server/{0}/{1}/{2}/{3}/{4}.json"); object[] params = {x, y, z, t, a}; system.out.println(mformat.format(params)); output:
http://server/1/2/3/4/5.json
Comments
Post a Comment