var str = "avdgftjhhihguttu";
var arr = [];
for (var i = 0; i < str.length / 2; i++) {
var idx = i * 2;
var s = str.substring(idx, idx + 2);
arr.push(s);
}
arr.join(":");
console.log(arr.join(":")); =》new_file.html:30 av:dg:ft:jh:hi:hg:ut:tu
转载于:https://www.cnblogs.com/chuxinsyn/p/7903235.html