String.prototype.format=function(){
if(arguments.length==0)
return this;
for(var s=this, i=0; i<arguments.length; i++)
s=s.replace(new RegExp("\\{"+i+"\\}","g"), arguments[i]);
return s;
alert("http://{0}/{1}".format("www.songyanjun.net", "index.html"));
//与上同理
alert("请输入{0},输完后再按存盘按钮".format("姓名"));
if(arguments.length==0)
return this;
for(var s=this, i=0; i<arguments.length; i++)
s=s.replace(new RegExp("\\{"+i+"\\}","g"), arguments[i]);
return s;
};
alert("http://{0}/{1}".format("www.songyanjun.net", "index.html"));
//与上同理
alert("请输入{0},输完后再按存盘按钮".format("姓名"));