JS字符串格式化

//字符串格式化
String.prototype.format = function () {
var values = arguments;
return this.replace(/{(d+)}/g, function (match, index) {
if (values.length > index) {
return values[index];
} else {
return "";
}
});
}; 
原文地址:https://www.cnblogs.com/yangyangming/p/11611303.html