Get the specified number string js

Reference: 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;
}

 

Guess you like

Origin www.cnblogs.com/linjiangxian/p/11464798.html