android/guava/src/com/google/common/base/CharMatcher.java
public int countIn(CharSequence sequence) {
    int count = 0;
    for (int i = 0; i < sequence.length(); i++) {
      if (matches(sequence.charAt(i))) {
        count++;
      }
    }
    return count;
  }
public int countIn(CharSequence sequence) {
    int count = 0;
    for (int i = 0; i < sequence.length(); i++) {
      if (matches(sequence.charAt(i))) {
        count++;
      }
    }
    return count;
  }
Returns the number of matching {@code char}s found in a character sequence.

<p>Counts 2 per supplementary character, such as for {@link #whitespace}().{@link #negate}().