首页 > 代码库 > String.prototype.formatWith

String.prototype.formatWith

1     String.prototype.formatWith = function () {
2         var args = arguments;
3         var reg = /\{(\d+)\}/g;
4         return this.replace(reg, function (g0, g1) {
5             return args[+g1] || ‘‘;
6         });
7     }

 

String.prototype.formatWith