使用此函數能返回字符串中某個字符或字符串出現的次數其中mainStr為要查找的字符串
function countInstances(mainStr
{
var count =
var offset =
do
{
offset = mainStr
if(offset !=
{
count++;
offset += subStr
}
}while(offset !=
return count;
}
From:http://tw.wingwit.com/Article/program/net/201311/14350.html