Java Utililty Methods String Occurence Count

List of utility methods to do String Occurence Count

Description

The list of methods to do String Occurence Count are organized into topic(s).

Method

intcountOccurencesOfChar(String str, char charToCount)
count Occurences Of Char
int len = str.length();
int occurences = 0;
String strgToCount = Character.toString(charToCount);
for (int index = 0; index < len; ++index) {
    String substr = str.substring(index, index + 1);
    if (strgToCount.equals(substr)) {
        occurences++;
return occurences;