Java Char Count countChar(CharSequence chars, char c)

Here you can find the source of countChar(CharSequence chars, char c)

Description

count Char

License

Open Source License

Declaration

public static int countChar(CharSequence chars, char c) 

Method Source Code

//package com.java2s;

public class Main {
    public static int countChar(CharSequence chars, char c) {
        int count = 0;
        for (int i = 0; i < chars.length(); i++) {
            if (chars.charAt(i) == c)
                count++;//w  w w .  j  a v a  2s. co  m
        }
        return count;
    }
}

Related

  1. charCount(String str, char sub)
  2. charCount(String subject, String needle)
  3. charCountRight(String str, String sub)
  4. countChar(char charIn, String stingIn)
  5. countChar(char[] line, char target_char)
  6. countChar(final int[] locator, final char c)
  7. countChar(final String aString, final char aChar)
  8. countChar(final String host, final char charactor)
  9. countChar(int start_index, int end_index, StringBuffer txt, char c)