Here is a line of string:
apple:{0},pear:{1},banana:{2}
I want to raw the variable to the string. Here is my code:
var AllString="apple:{0},pear:{1},banana:{2}";
var apple=0;
var pear=1;
var banana=2;
var NewString=AllString.replace("{0}",apple).replace("{1}",pear).replace("{2}",banana);
In spite it works, it is so troublesome.
I have learned C# before, and C# has a syntax sugar just like this:
var NewString=string.format(AllString,apple,pear,banana);
I am not sure but are there any similarities like this in jquery to make it more convenient? Thank you.