Simple example of js determining the number of times a character appears
function patch(re,s){ //Argument 1 regular expression, parameter 2 string re=eval_r("/"+re+"/ig"); //Not case sensitive, if required, remove i and change to re=eval_r("/"+re+"/g")var len = s.match(re).length;return len;}var str="Hello World";alert("num = " + patch("o",str));The above simple example of JS judging the number of times a certain character appears is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.