转载自: http://demon.tw/programming/javascript-sprintf.html function str_repeat(i, m) { for (var o = []; m > 0; o[--m] = i); return o.join(''); } function sprintf() { var i = 0, a, f = arguments[i++], o = [], m, p, c, x, s = ''; while (f) { if (m = /^[^…