class StringUtils {

  public static int countMatches(final String str, final char ch) {
    if (isEmpty(str)) {
      return 0;
    }
    int count = 0;
    for (int i = 0; i < str.length(); i++) {
      if (ch == str.charAt(i)) {
        count++;
      }
    }
    return count;
  }

}