js 实现每隔几个字符进行添加字符串
function Xreplace(str,length,reversed)
{
var re = new RegExp("\\d{1,"+length+"}","g");
ma = str.match(re);
if(reversed)ma.reverse();
return ma.join("a") + "a";//最后面不要"a" 就去掉( + "a")
}
alert(Xreplace("000100020003",4));
alert(Xreplace("000100020003",4,true));
alert(Xreplace("000100020003",4,false));