var mystring = 'This is the lorel ipsum text';var mycharArray = mystring.split('');var opArr = [];for(let i=0;i<mycharArray.length;i++){if(mycharArray[i]=='i'){//match the character you want to match opArr.push(i); }}console.log(opArr); // it will return matching index positionconsole.log(opArr.length); // it will return length
↧
Answer by Sagar Shinde for How to count string occurrence in string?
↧