find number of occurrences in excel code example
Example 1: c# count number of occurrences in string
char myChar = 'x';
string myString = "xyz";
int count = myString.Count(s => s == myChar);
Example 2: javascript count occurrences in string
function countOccurences(string, word) {
return string.split(word).length - 1;
}
var text="We went down to the stall, then down to the river.";
var count=countOccurences(text,"down"); // 2