Java Utililty Methods Char Count

List of utility methods to do Char Count

Description

The list of methods to do Char Count are organized into topic(s).

Method

intcountChar(char charIn, String stingIn)
count Char
int charCount = 0;
int charIndex = 0;
for (int i = 0; i < stingIn.length(); i++) {
    charIndex = stingIn.indexOf(charIn, i);
    if (charIndex != -1) {
        charCount++;
        i = charIndex + 1;
return charCount;
intcountChar(char[] line, char target_char)
count occurences of 'target_char' char
char c;
int len = line.length;
int count = 0;
for (int i = 0; i < len; i++) {
    c = line[i];
    if (c == target_char)
        count++;
return count;
intcountChar(CharSequence chars, char c)
count Char
int count = 0;
for (int i = 0; i < chars.length(); i++) {
    if (chars.charAt(i) == c)
        count++;
return count;
voidcountChar(final int[] locator, final char c)
count Char
if (c == '\n') {
    locator[0]++;
    locator[1] = 1;
    return;
locator[1]++;
intcountChar(final String aString, final char aChar)
count Char
if (aString == null) {
    return -1;
int wCount = 0;
int wMax = aString.length();
int wI = 0;
while (wI < wMax) {
    if (aString.charAt(wI) == aChar) {
...
intcountChar(final String host, final char charactor)
count char in host string
int count = 0;
for (int i = 0; i < host.length(); i++) {
    if (host.charAt(i) == charactor) {
        count++;
return count;
intcountChar(int start_index, int end_index, StringBuffer txt, char c)
count Char
int count = 0;
for (int i = start_index; i <= end_index; i++) {
    if (txt.charAt(i) == c) {
        count++;
return count;
intcountChar(String a_text, char a_character)
Count the number of a single character that occur in a string.
int count = 0;
String text = a_text;
int pos = text.indexOf(a_character);
while (pos != -1) {
    count++;
    pos = text.indexOf(a_character, pos + 1);
return count;
...
intcountCharacter(final String sourceString, final char lookFor)
count Character
if (sourceString == null) {
    return -1;
int count = 0;
for (int i = 0; i < sourceString.length(); i++) {
    final char c = sourceString.charAt(i);
    if (c == lookFor) {
        count++;
...
intcountCharacter(String content, char character)
Returns the number of occurrences of the given character in the given string.
int count = 0;
for (char c : content.toCharArray()) {
    if (c == character) {
        count++;
return count;