Java Char Count countChar(int start_index, int end_index, StringBuffer txt, char c)

Here you can find the source of countChar(int start_index, int end_index, StringBuffer txt, char c)

Description

count Char

License

Apache License

Declaration

public static int countChar(int start_index, int end_index, StringBuffer txt, char c) 

Method Source Code

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

public class Main {
    public static int countChar(int start_index, int end_index, StringBuffer txt, char c) {
        int count = 0;
        for (int i = start_index; i <= end_index; i++) {
            if (txt.charAt(i) == c) {
                count++;//  w  w w .j ava  2  s  .c o m
            }
        }

        return count;
    }
}

Related

  1. countChar(char[] line, char target_char)
  2. countChar(CharSequence chars, char c)
  3. countChar(final int[] locator, final char c)
  4. countChar(final String aString, final char aChar)
  5. countChar(final String host, final char charactor)
  6. countChar(String a_text, char a_character)
  7. countCharacter(final String sourceString, final char lookFor)
  8. countCharacter(String content, char character)
  9. countCharacterOccurrences(String string, char c)