参考:https://blog.csdn.net/maqinqin/article/details/5323824
function getStrCount(scrstr,armstr) { //scrstr 源字符串 armstr 特殊字符 var count=0; while(scrstr.indexOf(armstr) != -1 ) { scrstr = scrstr.replace(armstr,"") count++; } return count; }
参考:https://blog.csdn.net/maqinqin/article/details/5323824
function getStrCount(scrstr,armstr) { //scrstr 源字符串 armstr 特殊字符 var count=0; while(scrstr.indexOf(armstr) != -1 ) { scrstr = scrstr.replace(armstr,"") count++; } return count; }