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

intcharCount(final String s, final char c)
char Count
int r = 0;
for (int i = 0, len = s != null ? s.length() : 0; i < len; i++) {
    if (c == s.charAt(i)) {
        r++;
return r;
intcharCount(final String s, final char c)
Get the number of the occurence of a char in a string.
if (s == null)
    return 0;
final int len = s.length();
int count = 0;
for (int i = 0; i < len; i++)
    if (s.charAt(i) == c)
        count++;
return count;
...
intcharCount(int codePoint)
char Count
return codePoint >= MIN_SUPPLEMENTARY_CODE_POINT ? 2 : 1;
intcharCount(String s, char c)
char Count
int res = 0;
for (char ch : s.toCharArray())
    if (ch == c)
        res++;
return res;
intcharCount(String source, char target)
char Count
if (source == null) {
    return 0;
int count = 0;
for (int i = 0; i < source.length(); i++) {
    if (target == source.charAt(i)) {
        count++;
return count;
intcharCount(String str, char c, boolean countEscaped)
Helper method to count number of given characters in a string.
if (str == null)
    return -1;
int cnt = 0;
for (int i = 0; i < str.length(); i++) {
    if (str.charAt(i) == c) {
        if (i >= 1) {
            if (str.charAt(i - 1) == '\\') {
                if (countEscaped) {
...
intcharCount(String str, char chr)
char Count
int count = 0;
if (str != null) {
    int length = str.length();
    for (int i = 0; i < length; i++) {
        if (str.charAt(i) == chr) {
            count++;
    return count;
return count;
intcharCount(String str, char sub)
char Count
int charCount = 0;
int fromIndex = 0;
while ((fromIndex = str.indexOf(sub, fromIndex)) != -1) {
    fromIndex++;
    charCount++;
return charCount;
intcharCount(String subject, String needle)
char Count
return subject.split(needle).length - 1;
intcharCountRight(String str, String sub)
char Count Right
if (str == null) {
    return 0;
int charCount = 0;
String subStr = str;
int currentLength = subStr.length() - sub.length();
while (currentLength >= 0 && subStr.substring(currentLength).equals(sub)) {
    charCount++;
...