Java Char Count charCount(String s, char c)

Here you can find the source of charCount(String s, char c)

Description

char Count

License

Open Source License

Declaration

public static int charCount(String s, char c) 

Method Source Code

//package com.java2s;

public class Main {
    public static int charCount(String s, char c) {
        int res = 0;
        for (char ch : s.toCharArray())
            if (ch == c)
                res++;//from   www  . j  a  v  a  2s  . co  m
        return res;
    }
}

Related

  1. charCount(final String s, final char c)
  2. charCount(final String s, final char c)
  3. charCount(int codePoint)
  4. charCount(String source, char target)
  5. charCount(String str, char c, boolean countEscaped)
  6. charCount(String str, char chr)
  7. charCount(String str, char sub)