function chunk(str, n) { var ret = []; var i; var len; for(i = 0, len = str.length; i < len; i += n) {ret.push(str.substr(i, n)) } return ret }; chunk("The quick brown fox jumps over the lazy dogs.", 5).join('$'); // "The q$uick $brown$ fox $jumps$ over$ the $lazy $dogs."
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)