<script type="text/javascript">
/*计ç®åå符串å¨å符ä¸åºç°ç次æ°*/
//å符串
var str1 = 'zhulinjia zh lia tjqig qgx gja xx yy xxf xxxq wqja ix';
//å串
var str2 = 'a';
alert( Tongji(str1 , str2) );
//ç»è®¡
function Tongji(string , char)
{
var index = 0 , index1 = 0 , count = 0;
for(var i = 0; i < string.length && ( index1 !dao= -1 ); i++ )
{
index1 = string.indexOf(char, index);
index = index1 + 1;
count = i;
}
return count;
}
温馨提示:内容为网友见解,仅供参考