oh,啦啦啦。去跑跑看,用这个跑了下,直接吧eclipse跑挂了-。-
public int countChars(String toSearch,String c){
int count=0,i=-1;
while((i=toSearch.indexOf(c,i))!=-1)
count++;
return count;
}
-.-55555555555可怜
var s="我是@@你是@@他是@@哈哈哈哈哈";
function $Reg(input,reg,replace_txt)
{
var i=0;
return input.replace(reg,function(){return (++i)+replace_txt;})
}
alert($Reg(s,/@@/g,"A"));