Java String Occurence Count countOccurence(String matchedString, char occurence)

Here you can find the source of countOccurence(String matchedString, char occurence)

Description

count Occurence

License

Apache License

Declaration

public static int countOccurence(String matchedString, char occurence) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static int countOccurence(String matchedString, char occurence) {
        int count = 0;
        for (final char c : matchedString.toCharArray()) {
            if (c == occurence) {
                ++count;/*from   w  w  w .  ja  v  a2  s  .  co m*/
            }
        }
        return count;
    }
}

Related

  1. countOccurences(String from, String word)
  2. countOccurences(String haystack, String needle)
  3. countOccurences(String s, char c)
  4. countOccurences(String str, int ch)