//"{0}-{1}-{2}".format("xx","yy","zz")
//显示xx-yy-zz
String.prototype.format = function() {
var result=this;
if (arguments.length == 0)
return null;
for ( var i = 0; i < arguments.length; i++) {
var re = new RegExp('\\{' + (i) + '\\}', 'gm');
result = result.replace(re, arguments[i]);
}
return result;
};
扩展js,实现c#中的string.format方便拼接字符串
最新推荐文章于 2023-03-24 20:15:00 发布