String.prototype.format = String.prototype.f = function () {
var s =
this,
i = arguments.length;
while (i--) {
s = s.replace(new RegExp(‘\\{‘ + i + ‘\\}‘, ‘gm‘),
arguments[i]);
}
return s;
};
"chen {0} hua".format("zeng")
2021-08-13 06:55:51
String.prototype.format = String.prototype.f = function () {
var s =
this,
i = arguments.length;
while (i--) {
s = s.replace(new RegExp(‘\\{‘ + i + ‘\\}‘, ‘gm‘),
arguments[i]);
}
return s;
};
"chen {0} hua".format("zeng")