Java Char Count countChars(final String str, final char c)

Here you can find the source of countChars(final String str, final char c)

Description

count Chars

License

Open Source License

Declaration

final public static int countChars(final String str, final char c) 

Method Source Code

//package com.java2s;
// License as published by the Free Software Foundation; either

public class Main {
    final public static int countChars(final String str, final char c) {
        int count = 0;
        for (int i = 0; i < str.length(); ++i) {
            if (str.charAt(i) == c) {
                ++count;/*from  w ww . j  a v  a  2 s . co m*/
            }
        }
        return count;
    }
}

Related

  1. countCharacterOccurrences(String string, char c)
  2. countCharacters(String code, char c, int start, int end)
  3. countCharacters(String str, char chr)
  4. countCharInString(String s, char c)
  5. countChars( final String testString, final char match )
  6. countChars(final String str, final char chr)
  7. countChars(final String string, final String findStr)